Hello all,
I have a temporary file and at any time it may have only one of the following lines or none at all (empty file).
AAA 50 50 60 60 90 90
or
AAA 60 60 60 60 80 80 newfile:/path/to/a/file
or
newfile:/path/to/a/file
Needing an awk in my shell script to remove only the "newfile:/path/to/a/file" string if it exists. There are no spaces in the string. I used sed and it works fine except that if sed does not find the string pattern (empty file) it inserts a blank line in the file. That causes problems down the road. Yes, i'm sure I could just use another command to remove blank lines, but for the sake of efficiency, would rather not.
the sed that I used is
sed 's/newfile.*//' /tmp/tmpfile.tmp
Perhaps it could be modified as well. Trying awk this time.
Thanks for any help.
I have a temporary file and at any time it may have only one of the following lines or none at all (empty file).
AAA 50 50 60 60 90 90
or
AAA 60 60 60 60 80 80 newfile:/path/to/a/file
or
newfile:/path/to/a/file
Needing an awk in my shell script to remove only the "newfile:/path/to/a/file" string if it exists. There are no spaces in the string. I used sed and it works fine except that if sed does not find the string pattern (empty file) it inserts a blank line in the file. That causes problems down the road. Yes, i'm sure I could just use another command to remove blank lines, but for the sake of efficiency, would rather not.
the sed that I used is
sed 's/newfile.*//' /tmp/tmpfile.tmp
Perhaps it could be modified as well. Trying awk this time.
Thanks for any help.