Search Results

Search: Posts Made By: swayam123
2,244
Posted By pamu
Try using double square brackets..:) for blank...
Try using double square brackets..:)
for blank values of var you may need double square braces.
time=$1
var=$(echo "$time"|awk '{for(i=1;i<=NF;i++) if ( $i ~ ...
16,038
Posted By Skrynesaver
spacing around your tests (the square brackets...
spacing around your tests (the square brackets need to be separate tokens

a=9
b=10
if [ a -gt b ]
then
echo what now
else
echo that makes sense
fi
16,038
Posted By pamu
Please use spaces between square brackets. ...
Please use spaces between square brackets.

if [ $v_num -gt $comp_num ]
16,038
Posted By bmk
you should give the space in the condition.. if...
you should give the space in the condition..
if [ $v_num -gt $comp_num ]
1,176
Posted By pamu
Use sth like this.. line="Some text with ERR...
Use sth like this..

line="Some text with ERR message"
index=$(echo $line | awk '{for(i=1;i<=NF;i++) if($i~/^ERR/){print i}}')
echo $index
50,045
Posted By elixir_sinari
awk -v x='11/20/12' '$0~x,EOF'...
awk -v x='11/20/12' '$0~x,EOF' datefiltertestfile.txt
50,045
Posted By subramanian
print section of file from regular expression to...
print section of file from regular expression to end of file
awk '/2012\/20\/11/,EOF { print $0 }' filename
1,534
Posted By guruprasadpr
Hi $ awk...
Hi

$ awk '{a[++i]=$0;}/ERR-/{for(j=NR-x;j<=NR;j++)print a[j];}' x=1 file
some other text
ERR-12345
some blah blah blah
ERR-56789

You can specify your value of N against the x.

Guru.
1,265
Posted By itkamaraj
awk '/\[2012/{a=$0}/^ERR/{print a"-"$0}'...
awk '/\[2012/{a=$0}/^ERR/{print a"-"$0}' input.txt
[2012-11-12 : 11:59-ERR-XXXXX
[2012-11-12 : 12:01-ERR-XXXXX


---------- Post updated at 10:01 AM ---------- Previous update was at 09:59 AM...
2,719
Posted By elixir_sinari
The -o option prints only the strings matching...
The -o option prints only the strings matching the pattern, each on a separate line. I think this is available only with GNU grep.
You may try this awk script:
awk...
2,719
Posted By Yoda
grep -o "ERR-[0-9][0-9][0-9][0-9][0-9]"...
grep -o "ERR-[0-9][0-9][0-9][0-9][0-9]" input_file| sort | uniq -c
4,020
Posted By Yoda
sed -n '/10\/31\/2012/,/10\/31\/2012/p' file ...
sed -n '/10\/31\/2012/,/10\/31\/2012/p' file
sed -n '/11\/01\/2012/,/$/p' file
Showing results 1 to 12 of 12

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