Hello,
It appears that this line is lifted from a Korn shell script although it could also be Bourne. In it the sed command is configured not to write to standard output(the -n). sed is getting its input from the file represented by the variable ${SRVLOG} and that sed is writing the line matches from the variable ${TIMESTAMP} to the file represented by the variable ${RES_FILE} (the '/w ' and '/' are syntax wrappers for the timestamp line search). The entire command should be extracting lines with a particular timestamp from a syslog file(or something similar) and creating an output file with these line matches.
By converting the 'code' to an example command it might be easier to see how the command is set up.
sed -n /200301011200/w residual.file /var/log/syslog
Hope this helps!
Charlie Ehler
Hello,
My mistake! The '/' and '/w ' prevent command garbled errors.
Anyway the correct sed format(that works in solaris 2.5.1) is:
sed -n '/'match string'/w 'output_file input_file
Why this is correct is beyond me, since the man pages don't seem to indicate this.
Later!
Charlie Ehler
It's not on the sed man page because it's a shell feature. The whole sed command needs to be recognised as one parameter, and if you don't have the quotes the space between "/w" and "output_file" split the command into two parts, and the first part is no longer a complete sed command, hence "command garbled".
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.