Search Results

Search: Posts Made By: matrixmadhan
283,935
Posted By matrixmadhan
What is the need for me to joke here ? Words...
What is the need for me to joke here ?

Words you have used really have taken me aback.

Ok. coming to the point with your example.

try this first and then the later solution

echo "aa\naa"...
283,935
Posted By matrixmadhan
Changing to print c doesn't help. It should...
Changing to print c doesn't help.

It should be changed to the below as I had posted earlier . :)

awk ' BEGIN {RS=FS} { if ( $0 ~ /^aa$/ ) { c++; i=NR; } } END{if ( i == NR ) { c++ } print c}'...
283,935
Posted By matrixmadhan
This is absolutely working as expected. ...
This is absolutely working as expected.

Input is
aa<space>
aa

only the pattern in second line "aa" matches and not the one in the first line.

:)
283,935
Posted By matrixmadhan
there is one more problem with that with the...
there is one more problem with that

with the input posted by Shell and for search pattern as "aa" it would match "aaa" also

try this,
awk ' BEGIN {RS=FS} { if ( $0 ~ /^aa$/ ) { c++; i=NR; } }...
283,935
Posted By matrixmadhan
Here, print statement should have been ...
Here,

print statement should have been

print ++c
Showing results 1 to 5 of 5

 
All times are GMT -4. The time now is 01:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy