I am trying to use either awk or nawk in ksh88 to grep the word "Reason" in multiple files and than print the lines that say "Reason" in a particular format that is different from how they would normally print. The original input is as follows:
This is after the code is grepped for all lines containing "Reason" and then I egrep -v some things to eliminate lines that contain both "Reason" and other items. The below is the code that I have:
the problem aside from the fact that it is really long and there seems like there should be a better way to do this is that the last field gets printed on the newline.
This is the output I am getting:
I would like to be getting the following output:
Those last two lines should all be on one line...they were just too long to fit here.
Any help is greatly appreciated!!
---------- Post updated at 05:30 PM ---------- Previous update was at 05:20 PM ----------
Please ignore my last comment about the last two lines being on one line, the output as shown above is exactly how I want it to be
Okay so that works for pulling all of the files that end in .txt. However, I have created a variable for yesterday and I am trying to only find the files that contain yesterday in the filename. So when I try this code, it doesn't seem to work.
---------- Post updated at 10:27 AM ---------- Previous update was at 10:24 AM ----------
Nevermind, I just got that to work by doing this:
However I am having some trouble directing this to an $OUTPUT file variable....any idea as to where I should put the >>?
Hi Guys,
I am in need of some help; I have an xml message file which contains personal details as shown below:
, message=, message=, message=, message=, message=, message=
I want to use nawk to parse these xml messages but I am new to awk and nawk.
What I want is to get output... (7 Replies)
Hi! I am having a bit of a problem with my script. There are two different date formats that may appear in a file, either Jul-12 or Jul--6. I tried to create an if statement that searches for one of the formats and if that doesn't exist searches for the other, however it doesn't seem to be... (3 Replies)
Hi everyone,
i am new to unix , so i want to know what is the use of awk and nawk.
because in most of the place this cmds were used.
so, if anyone provied the basic idea of this cmds, it will be much helpfull for me . . ..
Thnks in Advance :) (9 Replies)
I'm not confident at all on how arrays work.
I want to know how to set arrays in ksh and in nawk (is there a difference??)
if someone can show me some examples of both that will be great. Tried to look up on the net but was confusing me more.
Any help would be appreciated. (2 Replies)
i'm new to shell scripting and have a problem please help me
in the script i have a nawk block which has a variable count
nawk{
.
.
.
count=count+1
print count
}
now i want to access the value of the count variable outside the awk block,like..
s=`expr count / m`
(m is... (5 Replies)
Hi all,
I can run the following script using nawk..However, I find that teh server dun support nawk.. May I know how to change teh script to use awk such that it will work? Very urgent.. thx!
nawk 'BEGIN {FS=OFS=","}
NR==FNR{arr=$2;next}
$0 !~ "Documentation"{print $0;next} ... (2 Replies)
Hello,
First of all, I am trying to duplicate the sum command using ksh/nawk
Lets assume the following algorithms work just fine and there is no calculation errors what so ever (which I doubt at this minute).
For now, I wanna make sure the script uses the BSD algorithim if -r is used... (0 Replies)
Can anyone explain to me why the first line doesn't work and the second seems to work fine. I am trying to find all occurances of text within a certain column (col 13) that start with the character V, I suppose it sounds simple but I have tried using the following but don't really understand what... (2 Replies)