Search Results

Search: Posts Made By: Chubler_XL
4,067
Posted By Chubler_XL
Here I want to use any of the following single...
Here I want to use any of the following single characters as field seperators: /, [, ] or space.

This equates to the regular expression [/ \][] (just like [ABC] would allow a single A, B or C...
4,067
Posted By Chubler_XL
This should correct the "[" and "]" chars around...
This should correct the "[" and "]" chars around the data and time line.

file=$1
if [ -f $file.gz ]
then command="gunzip -c"
else command=cat
fi
$command $file | awk -F"[/ \\\][]"...
4,067
Posted By Chubler_XL
If awk has no file parameter it will process...
If awk has no file parameter it will process stdin so pipe output of zcat to awk like this:

zcat server.log.gz | awk -F"[/ ]" -v S="24/01/2013 10:10" -v E="24/01/2013 10:30" '...code here...'
4,067
Posted By Chubler_XL
if($3>b[3])return 1; if($3,b[3])return -1; ...
if($3>b[3])return 1;
if($3,b[3])return -1;
...
if 3rd field (year) of current line is greater than 3rd field in input parameter (year of start or end date) return 1 (ie > 0).
As you can see...
4,067
Posted By Chubler_XL
Thanks for your Solaris corrections...
Thanks for your Solaris corrections MadeInGermany, nice to know that {n,n} regs don't work with nawk.

I'm not quite sure what the requirement is around this last like, the following change
will...
4,067
Posted By Chubler_XL
Don't think sed is capable of doing this, this...
Don't think sed is capable of doing this, this awk script (nawk if you on Solaris) should do what you ask (just change the S and E variables to match your range):

awk -F"[/ ]" -vS="24/01/2013...
Showing results 1 to 6 of 6

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