Search Results

Search: Posts Made By: andy391791
6,266
Posted By RudiC
awk '$0!=dup; {dup=_} /WARNING/{dup=$0}' file
awk '$0!=dup; {dup=_} /WARNING/{dup=$0}' file
1,779
Posted By RavinderSingh13
Hello andy391791, Following may help you in...
Hello andy391791,

Following may help you in same.

awk '{gsub("\n[^\n]*/",","); #### gsub, it's an awk's in-built keyword which is used for global substitutions, it's format is...
1,636
Posted By Don Cragun
It is not restricted to AIX. The standards...
It is not restricted to AIX. The standards explicitly state that the input Record Separator is the 1st character or the string assigned to RS and the results are unspecified if the string assigned...
16,843
Posted By MadeInGermany
The RS= is an initial variable assignment before...
The RS= is an initial variable assignment before opening the file.
The main loop only has the condition NR%2==0 where the default action is {print}.
1,098
Posted By RavinderSingh13
Hello andy391791, You could add a space...
Hello andy391791,

You could add a space in field separator else it will have spaces in the starting of the last field or 2nd field, so following should do the trick.

awk -F"= " '{print...
15,368
Posted By Aia
If you do not supply a pattern the DEFAULT...
If you do not supply a pattern the DEFAULT pattern is TRUE (or match every line)
'{x[$0]++}'
The action is performed, however, that action is not a program that would display any of it.
You can...
2,018
Posted By Don Cragun
I sincerely apologize. I haven't been getting...
I sincerely apologize. I haven't been getting enough sleep lately.

It looks like Corona688 and MadeInGermany have mostly cleaned up my mess. I sincerely thank both of them for correcting my...
2,018
Posted By Corona688
Greedy means earlier parts of the regex "win",...
Greedy means earlier parts of the regex "win", they will match as far as they can. They'll only ever give it up when the rest of the expression fails to match. So the first .* matches all the way...
2,018
Posted By MadeInGermany
The .* is greedy, that means it consumes as many...
The .* is greedy, that means it consumes as many characters as possible - while the other conditions are still met.
If there are two .* then the leftmost is most greedy.
2,018
Posted By Don Cragun
Please ignore this post. I obviously needed to...
Please ignore this post. I obviously needed to get some sleep before I posted it.

OK. I know that you already understand it, but just to be clear, the \1 in the replacement string expands to the...
2,018
Posted By Scrutinizer
You mean like so? sed 's/.*\(-.*-\).*/\1/' ...
You mean like so?
sed 's/.*\(-.*-\).*/\1/'

Better would be:
sed 's/.*\(-[^-]*-\).*/\1/'


--
With GNU grep:
grep -o -- '-[^-]*-'


--edit--
First answer above already provided by...
2,018
Posted By chapeupreto
What about: echo "Date range on 5th May is...
What about:

echo "Date range on 5th May is between -010516 and 050516- please continue " | sed 's/.*\(-.*-\).*/\1/'
10,033
Posted By Don Cragun
On AIX 7.1, try that script using ksh93 instead...
On AIX 7.1, try that script using ksh93 instead of ksh.
Showing results 1 to 13 of 13

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