Calling Unix Pululu Chalanachithram.com | Topics | Search
Hide Clipart | Log Out | Register | Edit Profile

Last 30 mins | 1 | 2 | 4 hours     Last 1 | 7 Days

Chalanachithram.com DB » TF Industry related » Archive through August 11, 2012 » Calling Unix Pululu « Previous Next »

Author Message
Top of pagePrevious messageNext messageBottom of page Link to this message

Gamingfan
Junior Artist
Username: Gamingfan

Post Number: 169
Registered: 08-2012
Posted From: 59.93.115.195

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, August 10, 2012 - 05:21 am:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Jupiter:

30 years in the industry lo sagam ...

rase code lo clarity miss avadu ...
vache bug lo complexity miss avadhu ...

rao .. code'swara rao ...




hats off

oka kotta vishayam telusukunna by the above code
I AM NOT LAZY I JUST REST BEFORE I GET TIRED!

LOVE IS THE SLOWEST FORM OF SUICIDE!
Top of pagePrevious messageNext messageBottom of page Link to this message

Platypus
Comedian
Username: Platypus

Post Number: 1062
Registered: 01-2008
Posted From: 122.169.172.142

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, August 10, 2012 - 05:19 am:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Platypus:

Your solution is much better. Thank you. I will go with yours.




With the assumption that there will be only two rows per key.

My solution works with any number of rows per key i guess. But for the requirement, I am sure there will be only two rows per key. So I will go with the simpler solution :-)
Naaku nacchindi janaalaki nacchadu... Janaalaki nacchindi naaku nacchadu... Nenanthe.. adho type.
Top of pagePrevious messageNext messageBottom of page Link to this message

Jupiter
Moderator
Username: Jupiter

Post Number: 11595
Registered: 05-2011

Rating: 
Votes: 5 (Vote!)

Posted on Friday, August 10, 2012 - 05:18 am:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Platypus:

Your solution is much better. Thank you. I will go with yours.




30 years in the industry lo sagam ...

rase code lo clarity miss avadu ...
vache bug lo complexity miss avadhu ...

rao .. code'swara rao ...
Wrong is wrong even if every one is doing it .. Right is always right even if no one is doing it!!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Platypus
Comedian
Username: Platypus

Post Number: 1061
Registered: 01-2008
Posted From: 122.169.172.142

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, August 10, 2012 - 05:16 am:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)


Jupiter:

# awk -F '|' '{key = $1; one = $2; getline; two = $2; print key "|" one "|" two


' sample.txt }

Your solution is much better. Thank you. I will go with yours.
Naaku nacchindi janaalaki nacchadu... Janaalaki nacchindi naaku nacchadu... Nenanthe.. adho type.
Top of pagePrevious messageNext messageBottom of page Link to this message

Platypus
Comedian
Username: Platypus

Post Number: 1060
Registered: 01-2008
Posted From: 122.169.172.142

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, August 10, 2012 - 05:13 am:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

Got it.

awk 'BEGIN{FS="|"} {a[$1];b[$1]=b[$1]"|"$2}END{for (i in a) printf("%s%s\n", i,b[i])}' $file

does the trick. Thanks anyway :-)
Naaku nacchindi janaalaki nacchadu... Janaalaki nacchindi naaku nacchadu... Nenanthe.. adho type.
Top of pagePrevious messageNext messageBottom of page Link to this message

Jupiter
Moderator
Username: Jupiter

Post Number: 11594
Registered: 05-2011

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, August 10, 2012 - 05:13 am:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

# awk -F '|' '{key = $1; one = $2; getline; two = $2; print key "|" one "|" two}' sample.txt
1|2.56|3.45
2|2.78|3.55
3|2.98|2.76
Wrong is wrong even if every one is doing it .. Right is always right even if no one is doing it!!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Gamingfan
Junior Artist
Username: Gamingfan

Post Number: 167
Registered: 08-2012
Posted From: 59.93.115.195

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, August 10, 2012 - 05:01 am:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

grep and sed taruvatadega awk ante?

also there are other versions like nawk and gawk

do u want to sculpt the commands?
I AM NOT LAZY I JUST REST BEFORE I GET TIRED!

LOVE IS THE SLOWEST FORM OF SUICIDE!
Top of pagePrevious messageNext messageBottom of page Link to this message

Jupiter
Moderator
Username: Jupiter

Post Number: 11593
Registered: 05-2011

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, August 10, 2012 - 04:57 am:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

let me give a try
Wrong is wrong even if every one is doing it .. Right is always right even if no one is doing it!!!
Top of pagePrevious messageNext messageBottom of page Link to this message

Platypus
Comedian
Username: Platypus

Post Number: 1059
Registered: 01-2008
Posted From: 122.169.172.142

Rating: N/A
Votes: 0 (Vote!)

Posted on Friday, August 10, 2012 - 04:53 am:   Insert Quote Edit PostDelete PostPrint Post   Move Post (Moderator/Admin Only)Ban Poster IP (Moderator/Admin only)

Help please.

I have a file that has the following contents

1|2.56
1|3.45
2|2.78
2|3.55
3|2.98
3|2.76

I need to get the following output

1|2.56|3.45
2|2.78|3.55
3|2.98|2.76

How to do it in AWK? I can write a 10 line script to do it but was wondering if there is a single AWK command that does it.
Naaku nacchindi janaalaki nacchadu... Janaalaki nacchindi naaku nacchadu... Nenanthe.. adho type.

Add Your Message Here
Post:
Bold text Italics Underline Create a hyperlink Insert a clipart image HASH(0x9f67500){Movie Clipart}
Show / Hide regular icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

 N   O   P   Q   R   S   T   U   V   W   X   Y   Z  

Show / Hide Filmy icons selection options

Click on following links to open cliparts by Alphabetical Order

 A   B   C   D   E   F   G   H   I   J   K   L   M  

 N   O   P   Q   R   S   T   U   V   W   X   Y   Z  


Username: Posting Information:
This is a public posting area. Enter your username and password if you have an account. Otherwise, enter your full name as your username and leave the password blank. Your e-mail address is optional.
Password:
E-mail:
Options: Enable HTML code in message
Automatically activate URLs in message
Action: