Unix C++
Would you like to react to this message? Create an account in a few clicks or log in to continue.

how to use a string as a delimiter?

3 posters

Go down

how to use a string as a delimiter? Empty how to use a string as a delimiter?

Post by mightyganesh Wed Mar 03, 2010 2:05 pm

In the cut command we can use only one character as the delimiter with the -d switch.

but i want to use a string or a pattern as a delimiter how can i do it?

and i wanna know if we have any other command for column delimiter??
mightyganesh
mightyganesh

Posts : 53
Points : 92
Join date : 2010-02-26
Age : 35

http://ganeshguna.blogspot.com

Back to top Go down

how to use a string as a delimiter? Empty Re: how to use a string as a delimiter?

Post by Maithreyi Wed Mar 03, 2010 4:09 pm

Cut allows only a single character delimiter.String as a delimiter not possible with cut.

Maithreyi

Posts : 76
Points : 142
Join date : 2010-03-03
Age : 36
Location : Haldia

Back to top Go down

how to use a string as a delimiter? Empty Re: how to use a string as a delimiter?

Post by mightyganesh Wed Mar 03, 2010 4:53 pm

do we have any other vertical delimiter other than cut command?
mightyganesh
mightyganesh

Posts : 53
Points : 92
Join date : 2010-02-26
Age : 35

http://ganeshguna.blogspot.com

Back to top Go down

how to use a string as a delimiter? Empty Re: how to use a string as a delimiter?

Post by akalya Thu Mar 04, 2010 5:50 pm

@ganesh
try this:
$cat abc.txt
123li456li789
987li654li321

$awk -F "li" '{print $1}' abc.txt
123
987




Exclamation

akalya

Posts : 70
Points : 86
Join date : 2010-03-04

Back to top Go down

how to use a string as a delimiter? Empty Re: how to use a string as a delimiter?

Post by Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum