Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.
sed to find and add lines
Name: gpatel Date: November 4, 2005 at 07:11:22 Pacific OS: unix CPU/Ram: 256
Comment:
Hey all, I am trying to add a string at the end of the line. and that line should start w/ /view/ so for exaple. if you have file and the line should read /view/hello/thankyou/file.bin /view/yes/red/blue.bin
i wanted to add @@good.bin at end of the both line so it should read /view/hello/thankyou/file.bin@@good.bin /view/yes/red/blue.bin@@good.bin
so basically anything start with /view should have @@good.bin at the end of the line. can someone help me w/ a script or anything. thanks a lot ~gpatel
the program was writter to assume that line start w/ /view but the line start w/ File Input or anything else. how can i still use the program. like can i use something like line*/view* or something like that? thanks, GPATEL
0
Response Number 4
Name: nails Date: November 11, 2005 at 09:43:07 Pacific
Reply:
Sorry I missed your later post. You want to flag any line that has /view in it? This should work:
#!/bin/ksh
while read line do [[ $line = *"/view"* ]] && line="$line"@@good.bin echo "$line" done < data.file
Summary: I am attempting to find a particualr line in a file and then replace it. Unfortunatly i can only guaruntee the content of the line prior to the one i am trying to edit. I have used grep -n and a cut...
Summary: I'm writing my first ever script so I'm a bit of a novice, hopefully this problem is simple: I need to take a number from one file, and place it in a specific location in another. I've got the script...
Summary: hello all, I have a to find and replace a strings in a file, for which I have a findstring.txt, which contains all strings to be found in each line and replacestring.txt, which contains all strings to...