You can try following changes in your code and let me know if that helps.
1st: Please change . to \., to remove it's special meaning in search part of awk. For example into your case. /1\.2 Install TCP Wrappers/ AND /1\.1 Apply latest OS patches/.
2nd: As mentioned by you in your post, on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk , /usr/xpg6/bin/awk, or nawk.
3rd: Also I have seen symbol ` in starting of awk if you are NOT storing this result to a variable then kindly remove them too.
So it can be something like below.
Hope this may help you.
Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
Your description isn't at all clear. Why are you setting the input field separator to a comma if you aren't doing anything with any fields? If you're trying to print a line giving the name of the file followed by the contents of the file, try:
If you're trying to print files with the file's name at the start of each line from that file, try:
If you're trying either of these on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk.
If neither of these are what you're trying to do, show us some sample contents for your two input files, give a full English description of the changes you want to make to the input, and show us the output you're trying to produce from those sample inputs.
The two code segments you have shown us do not even come close to doing what you described. And, the various versions of awk on most Solaris systems do not include a nextfile operator (and your description doesn't seem to need it even if your version of awk does include it).
Your description isn't at all clear. Why are you setting the input field separator to a comma if you aren't doing anything with any fields? If you're trying to print a line giving the name of the file followed by the contents of the file, try:
If you're trying to print files with the file's name at the start of each line from that file, try:
If you're trying either of these on a Solaris/SunOS system, change awk to /usr/xpg4/bin/awk.
If neither of these are what you're trying to do, show us some sample contents for your two input files, give a full English description of the changes you want to make to the input, and show us the output you're trying to produce from those sample inputs.
The two code segments you have shown us do not even come close to doing what you described. And, the various versions of awk on most Solaris systems do not include a nextfile operator (and your description doesn't seem to need it even if your version of awk does include it).
I have a log file which contains information like below (more than 200 ERROR sets).
Here I want to find first .c file and function after "ERROR: AddressSanitizer" line.
If you see here after "ERROR:" line first
file - asfrecohandling.c
function - ASFPotRecoHandling_Create_RecPaxSrvcComp
... (6 Replies)
Please can you let me know how to print all the matching lines from a file in one single line using awk. Thanks
I have the following data in the input file
data1
voice2
voice1
speech1
data2
data3
...
...
voice4
speech2
data4
and the output should be as follows
data1 data2... (4 Replies)
awk 'BEGIN{IGNORECASE=1} /error|warning|exception/ { ++x } END { print x }' filename
The above command returning the number of times the pattern present in the file. But I want the the line number as well. please help me out (6 Replies)
Hello,
i want to use new line character in cut command
i want to display 3rd line of a file using cut only( not by sed or head -tail command)
can anyone suggest me ?
Regards (12 Replies)
Hi. Is there a way in awk to show all lines between a line number and the next line containing a particular regex? We can do these, of course:
awk '/regex1/,/regex2/' filename
awk 'FNR > X && FNR < Y' filename
But can they be combined? Thanks. (3 Replies)
Hello,
I cannot figure this one out. I would like to do the following. I have a line that has 7 words. It is possible that the line can have 20 words too. I always want to show the 9th word and beyond. The 9th word will always change so I do not have something to search for, so I think... (1 Reply)