Search Results

Search: Posts Made By: mike_ap2006
8,475
Posted By mike_ap2006
Hi I got it fixed. As i m redirecting to the...
Hi I got it fixed.

As i m redirecting to the same file it was not working.
So i used outfile to get the result and used a mv command

awk -F"|" '{ idx=$2 FS $3 FS $4 FS $5; sum[idx] += $7;...
8,475
Posted By mike_ap2006
I tried them...Still not working.
I tried them...Still not working.
8,475
Posted By mike_ap2006
sixth[name] and not sixth[idx].. sorry.. but...
sixth[name] and not sixth[idx].. sorry.. but still not working :mad:
8,475
Posted By mike_ap2006
Hi Vgersh, This command is working perfect...
Hi Vgersh,

This command is working perfect in command line.

when i m using this code it gives an error "
awk: sum is not an array"

Can u please help. Sorry to bother you again. Thanks a...
3,409
Posted By mike_ap2006
Thanks a lot Deepak. Vgersh helped me in...
Thanks a lot Deepak.

Vgersh helped me in doing my task with awk command.

to find and group records in file. Please have a look at this thread for more in detail.

Thanks again for your help....
8,475
Posted By mike_ap2006
Wow Wow Wow!!!!!!!! I Couldnt Say Anything......
Wow Wow Wow!!!!!!!!
I Couldnt Say Anything... Awesome...
U R A Real Genius... Great And Thanks A Ton...
This Was Bugging Me For Last 3 Days... Great Relief... Thanks A Million :d
8,475
Posted By mike_ap2006
Hi Vgersh, Thanks for your response. But...
Hi Vgersh,

Thanks for your response. But the code

sum[$1 FS $2 FS $3 FS $4 FS $5] will compare fields from 1 to 5.

I need to comapre fields from 2 to 5 and aggregate, while printing i...
3,409
Posted By mike_ap2006
Hi Deepak, Thanks for your reply. but...
Hi Deepak,

Thanks for your reply.

but i did not fully get you.

Do u mean to say that i should do like this?

while read line
do
str=`echo $line | awk '{split($0, date,"|"); print...
8,475
Posted By mike_ap2006
Great!!
Vgersh,
WOW!!! Thats great and helped me..

but when i use this command,

awk -F"|" '{ sum[$2 FS $3 FS $4 FS $5] += $7 } END { for (name in sum) print name"|"sum[name] }' data_file

it prints...
8,475
Posted By mike_ap2006
How Can I Aggregate A Field In A File
I Have a file

34EMEA|VODAFONE ES|5484|CPN|04/01/07|1|300
34LA|VODAFONE ES|5484|CPN|04/01/07|1|300

how can i aggregate it to
34EMEA|VODAFONE ES|5484|CPN|04/01/07|1|600

awk -F"|" '{ sum[$4]...
3,409
Posted By mike_ap2006
ignore spaces in search pattern in grep
Hi

can you also tell me how i can acheive the below


i have a code in which i assign a value to a str variable.
Say line contains,
line=Field|Location ES|comp|dur|10

str=`echo $line |...
Forum: SCO 04-18-2007
29,735
Posted By mike_ap2006
Use a string with spaces as search pattern in Grep
Hi I have a string variable

>Cat input.dat

This is a TEXT
This is a No

str="This is a TEXT"
cat input.dat | grep "$str" works fine in command line

but when i use it in shell script it...
Showing results 1 to 12 of 12

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