Change that, I am still having issues. I added a newline in vi when I was testing. The source file has no newline and it seems sed will not even read it. My output from previous post is empty with correct source file. I try and add a newlne so sed will read it with
# /usr/bin/sed '$a\
> ' /myfile
My output is empty again. I guess I need a command to add a new line before I can have sed work with it? Thoughts?
You mean that the input data file has no newline at the end, and your sed will not cope with such a file?
There are some tools which will add a missing newline on the last line as a side effect, but with any luck, none of them are installed on your system. Try awk for a start. You might as well do the substitution in awk too then.
# /usr/bin/awk '{ gsub ("XXZZXXZZXX ", "\n") }1' /myfile
awk: syntax error near line 1
awk: illegal statement near line 1
awk: syntax error near line 1
awk: bailing out near line 1
#
This added a new line
echo >>myfile
Then I used the sed from above. I am more familiar with sed. Thanks again!
For what it's worth, the gsub function is an addition which was not present in the original Aho Weinberger Kernighan version of awk. Perhaps you could find nawk, mawk, gawk, or XPG4 awk on your system.