Quantcast
Channel: UNIX and Linux Forums
Viewing all articles
Browse latest Browse all 16232

understand sed

$
0
0
Code:

cat teledir.txt
jai sharma 25853670
chanchal singhvi 9831545629
anil aggarwal 9830263298
shyam saksena 23217847
lalit chowdury 26688726

If i use the below command , it is giving me the output with "," in between two name. how ? and also i would like to know the reason for the space used in between ([a-z]*\) *\([a-z]*\) and \2, \1/' and what is the use of specifying two [a-z] and what *\ means?

Code:

sed 's/\([a-z]*\) *\([a-z]*\)/\2, \1/' teledir.txt | sort

aggarwal, anil 9830263298
chowdury, lalit 26688726
saksena, shyam 23217847
sharma, jai 25853670
singhvi, chanchal 9831545629


Viewing all articles
Browse latest Browse all 16232

Trending Articles