Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi to all.
I am new to linux. I have a csv file like this
"21","Ramesh","5","aiubghed"
"21","Ramesh","4","ghed"
"21","Ramesh","0","aiubaiub"
"21","Suresh","5","aghedghed"
"19","Suresh","A","aigheded"
"19","Suresh","A7","aiughedhed"i need the output like this
Ramesh , suresh
aiubghed , aghedghed
ghed , aigheded
aiubaiub , aiughedhedIs it possible to do it in awk or sed. I am new to linux. please some help ..
regards
ramesh

I can not see any pattern. Can you explain?
Maybe this will get you started; this command:
tr -d \" < csv.file|nawk ' BEGIN { FS="," } { printf("%s , %s\n", $2, $4) } '
delivers this output - printing the 2nd and 4th fields:
Ramesh , aiubghed
Ramesh , ghed
Ramesh , aiubaiub
Suresh , aghedghed
Suresh , aigheded
Suresh , aiughedhed

Thankyou very much for your reply.
data is like this
First column second column
Ramesh , aiubghed
Ramesh , ghed
Ramesh , aiubaiub
Suresh , aghedghed
Suresh , aigheded
Suresh , aiughedhed
Kathir , aiddtghed
Kathir , ghteteed
Kathir , aiuopiiub
john , agheddlked
john , aigpqwsed
john , aidffedhedi need output like
First column-Second column - Third column
Ramesh - Suresh - Kathir
aiubghed - aghedghed - aiddtghed
ghed - aigheded - ghteteed
aiubaiub - aiughedhed - aiuopiiub
like that for fourth.Fourth column
john
agheddlked
aigpqwsed
aidffedhedI can't able to align columns properly here. so i have differentiated columns with hypen(-)

Hi , i don't find any pattern in my file. But if pattern is there how can we able to extract.
Suppose to be like this
Ramesh , abcd1
Ramesh , abcd2
Ramesh , abcd3
Suresh , abcd0
Suresh , abcd5
Suresh , abcd6
Kathir , abcd7
Kathir , abcd8
Kathir , abcd0
john , abcd1
john , abcd3
john , abcd7.
Thanks for reply.It will be very much helpful to me, if u can help me in this.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |