Search Results

Search: Posts Made By: siramitsharma
2,544
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,016
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,532
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?
1,839
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,710
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..
1,710
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,710
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,710
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...
9,239
Posted By Akshay Hegde
I would simplify like this $ awk '{print...
I would simplify like this
$ awk '{print $0,++a[$0]}' file
9,239
Posted By anbu23
awk ' { arr[$0]++; print $0 "," arr[$0] } '...
awk ' { arr[$0]++; print $0 "," arr[$0] } ' input
3,510
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,510
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,510
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,502
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,502
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,502
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,175
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,011
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,211
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,815
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,815
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 -
Forum: Solaris 07-13-2009
8,589
Posted By radoulov
Try to change: expect "password:" ...
Try to change:

expect "password:" to

expect "Password:"
Showing results 1 to 22 of 22

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