Hello Friends
I want to process only those lines which are not started with a * or "
example File name:
GRX
"RxDataTime, NSysClkEn, Frame","Size","Sleep","TNum","TSet","TWait"
*Init Start
*Comment Generated from: C:\Documents and Settings
000000,0000,1,0,0,0,0,0,0
000000,0000,0,0,0,0,0,0,0
In the file I only want to process only the last two lines..
I need a help badly..
Thanks in advance..
user_pradyu
Two methods using grep
grep -v '^\*' filename | grep -v '^\"'
egrep -v '^\*|\"' filename
Many many thanks for the reply ,,but when I merge it with a gawk or nawk it seems to processing all the lines..
like
#!/usr/bin/ksh -f
egrep -v '^\*|\"' GRX |
gawk '
{
print $0
} ' GRX
it displays me all the lines in the file..
user_prady:
Many many thanks for the reply ,,but when I merge it with a gawk or nawk it seems to processing all the lines..
like
#!/usr/bin/ksh -f
egrep -v '^\*|\"' GRX |
gawk '
{
print $0
} ' GRX
it displays me all the lines in the file..
I am not sure what exactly you are looking for. Why gawk/awk is required here?
egrep -v '^\*|\"' GRX should give teh expected result.
Is my understanding correct?
hi,
Follow code can filter out all your desired lines. Just put all your logic in the pring section, then it will only deal with those lines.
code:
awk '$0 !~ /^"/ && $0 !~ /^\*/{
print
}' filename
summer_cherry:
hi,
Follow code can filter out all your desired lines. Just put all your logic in the pring section, then it will only deal with those lines.
code:
awk '$0 !~ /^"/ && $0 !~ /^\*/{
print
}' filename
First of all I want to applogize if I explained wrongly..
Thank you very much for the code ,, That exact code I needed..
Hats of to you brilliants..
Now I m merging that with my code..
Hope your kindness remain the same always..
user_prady
Again I m facing some problem with implementing function in it ..
like
gawk '
BEGIN{}
$0 !~ /^"/ && $0 !~ /^\*/{
print ...
function my_function(){}
}' filename
Please help ....
[quote="user_prady,post:6,topic:178389"]
First of all I want to applogize if I explained wrongly..
Thank you very much for the code ,, That exact code I needed..
Hats of to you brilliants..
Now I m merging that with my code..
Hope your kindness remain the same always..
user_prady
[quote]
Is it not possible to define my own function ??
put your function outside the action block
gawk '
BEGIN{}
$0 !~ /^"/ && $0 !~ /^\*/{
print
}
function my_function()
{
print "echo"
}
' filename
I got that where I was wrong..
Thanks a lot ... Atlast I got what I wanted ..Thank you very much for your valuable time ..
Regards,
Pradyumna