Text Manipulation Help

Hello unix.com people!

How can I modify a text in format:

A:B:C 
A:B:C
A:B:C

into

C/A/B
C/A/B
C/A/B

Note: Text is line by line and "C", "B", "A" fields are different each row.

Thanks in advance.

tr : / < infile

Yes but I want to change the order of them also:

example:

lisa:ann:miller
andrew:frank:brown

to

miller/lisa/ann
brown/andrew/frank

Sorry :slight_smile: I missed this important detail:

awk -F: '{
  print $3, $1, $2
  }' OFS=/ infile
1 Like

thanks a million, tested and working.

perhaps try with find?

Through Sed..

sed 's/\(.*\):\(.*\)/\2:\1/;s/:/\//g' inputfile

Using Perl:

$
$
$ cat f19
A:B:C
A:B:C
A:B:C
$
$ perl -plne 's|^(.*):(.)$|$2/$1|; s|:|/|g' f19
C/A/B
C/A/B
C/A/B
$
$ perl -plne 'split/:/; unshift @_,pop @_; $_=join"/",@_' f19
C/A/B
C/A/B
C/A/B
$
$

tyler_durden