Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I'm very new to writing script files and I was wondering how I would go about creating a simple script file that would edit another input file. What I ...
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    1

    Newbie question- how do i write a script file to edit another file

    Hi,
    I'm very new to writing script files and I was wondering how I would go about creating a simple script file that would edit another input file. What I have in the input file are geometry locations, but I need to add a negative sign to all the x locations.

    "point 0.123 0.456" (a thousand of these "points")

    needs to be

    "point -0.123 0.456"

    There is some other text throughout the file, but this is all i need to do. I'm running a bash shell in fedora.

    Thanks

  2. #2
    Linux User
    Join Date
    May 2008
    Location
    NYC, moved from KS & MO
    Posts
    251
    Try
    Code:
    awk '/^point/ {print $1,"-"$2,$3}' your_input_file > output_file

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...