Search Results

Search: Posts Made By: siramitsharma
2,560
Posted By RavinderSingh13
Hello siramitsharma, If I understood your...
Hello siramitsharma,

If I understood your requirement correctly, could you please try following and let me know if this helps you.

echo "014387650" | awk '{n=split($0,...
16,067
Posted By RudiC
As long as you keep us guessing (e.g. on you file...
As long as you keep us guessing (e.g. on you file structrue) and don't post exact specifications, I'm afraid we (at least I) can't help further.
3,556
Posted By RudiC
Why don't you use the FILENAME variable for...
Why don't you use the FILENAME variable for identifying the file being read?
Forum: Solaris 07-13-2009
8,607
Posted By radoulov
Try to change: expect "password:" ...
Try to change:

expect "password:" to

expect "Password:"
1,844
Posted By RudiC
If you're happy with the result, I think we're...
If you're happy with the result, I think we're done. There's no file being iterated twice. And, instead of using substr several times, you could put its result into a variable and use that four times.
1,714
Posted By RavinderSingh13
Hello, If order doesn't matters then...
Hello,

If order doesn't matters then following may help you.



sort -t, -k2 check_change_check12113 | awk -F"\," 'BEGIN{print "DATE,KB,MB"} {a[$1]=a[$1] OFS $3} END{for(i in...
1,714
Posted By Makarand Dodmis
With maintaning order sort -t, -k2...
With maintaning order


sort -t, -k2 input_file | nawk -F, '{a[$1]=a[$1]?a[$1]FS$3:$1FS$3} END{for(i in a) print a[i]|"sort"}'
1,714
Posted By Scrutinizer
Try: awk 'BEGIN{print "DATE,KB,MB"} {A[$2]=$3}...
Try:
awk 'BEGIN{print "DATE,KB,MB"} {A[$2]=$3} !(NR%2){print $1, A["KB"], A["MB"]}' FS=, OFS=, file

DATE,KB,MB
01-APR-14,822714,8133431
02-APR-14,757140,7770368
03-APR-14,815427,7590511...
1,714
Posted By Scrutinizer
Sure: !(NR%2){ # On...
Sure:
!(NR%2){ # On every even line
print $1, A["KB"], A["MB"] # Print the first field, array element "KB" and "MB"
}

The array always has only two elements..
9,272
Posted By anbu23
awk ' { arr[$0]++; print $0 "," arr[$0] } '...
awk ' { arr[$0]++; print $0 "," arr[$0] } ' input
9,272
Posted By Akshay Hegde
I would simplify like this $ awk '{print...
I would simplify like this
$ awk '{print $0,++a[$0]}' file
3,533
Posted By RavinderSingh13
Hello, Just add {print} in place of print. ...
Hello,

Just add {print} in place of print.
It should work then.


Thanks,
R. Singh
3,533
Posted By Franklin52
Should be: awk -F,...
Should be:
awk -F, 'dupentries[$1,$2,$3,$4,$5,$6,$7,$8]++ {print > "Duplicates"; next}{print}' inputfile > inputfile.tmp
3,533
Posted By Don Cragun
Try: awk -F,...
Try:
awk -F, 'dupentries[$1,$2,$3,$4,$5,$6,$7,$8]++ {print > "Duplicates"; next};print' inputfile > inputfile.tmp
mv inputfile.tmp inputfile
1,511
Posted By pravin27
awk -F"|" 'FNR==1{++cnt} ...
awk -F"|" 'FNR==1{++cnt}
cnt==1{ACTFILE[$1]=$2"|"$3"|"$4"|"$5"|"$6;a[$1]=$7"000000";next}
cnt==2{DEACTFILE[$1]=$2"|"$3"|"$4"|"$5"|"$6;d[$1]=$7"000000";next}
{
if (ACTFILE[$1] && $5 gt a[$1] )...
1,511
Posted By Akshay Hegde
You can try something like this, as Scrutinizer...
You can try something like this, as Scrutinizer already suggested


awk '

FNR==1{
++counter
}
counter==1 {
ACTFILE[$1]=$2 FS...
1,511
Posted By Scrutinizer
Since you are only comparing dates and one date...
Since you are only comparing dates and one date is in YYmmddHHMMSS format and the other in YYmmdd, you could just slap "000000" at the end of the latter and do a numerical comparison.
2,193
Posted By Don Cragun
The problem is that the order of the elements...
The problem is that the order of the elements accessed from an array by the awk command:
for (index in array) {
do stuff
}
is unspecified.

The index(string1, string2) function will...
2,019
Posted By Don Cragun
Since you sent me private mail asking me to help...
Since you sent me private mail asking me to help you on this again, I take it that you ignored my previous messages in this thread. The archive files produced by awk contain lots of NULL bytes; so...
3,219
Posted By MadeInGermany
Like I said, replace the BEGIN by a main loop...
Like I said, replace the BEGIN by a main loop over the first file argument (file1).
The variable line becomes $0, and $1,$2 etc. are the fields of $0.
Further, awk does not accept if ... else if...
5,845
Posted By RudiC
How about applying our advices and creating /...
How about applying our advices and creating / testing a revised code. If that does not work, come back for help. One more comment: As the bb.txt file entries and thus BB elements are having 4 chars,...
5,845
Posted By Scrutinizer
You cannot use both stdin and file input like...
You cannot use both stdin and file input like that, you would need the "-" file operand..
Try:
zcat samplefile.tar.gz | awk '...' bb.txt -
Showing results 1 to 22 of 22

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