One Day One Cmd

Place for playing with commands…

Day 23: $ tr

ODOC:$tr start-set end-set.tr translates one set of charas to another.It replaces all chars in start-set with corresponding chars in end-set….

eg:$tr a-z A-Z< foo.txt.It will replace small a-z to A-Z in it. $tr -d a

Advertisements

One response to “Day 23: $ tr

  1. peacerex August 11, 2010 at 5:03 am

    AWK :

    Using awk in a One Liner

    I began using awk to print specific fields in output. This worked surprisingly well, but the efficiency went through the floor when I wrote large scripts that took minutes to complete. Here, however, is an example of my early awk code:

    ls -l /tmp/foobar | awk ‘{print $1″\t”$9}’

    This code takes some input, such as this:

    -rw-rw-rw- 1 root root 1 Jul 14 1997 tmpmsg

    and generates output like this:

    -rw-rw-rw- tmpmsg

    Regards
    Rex Andrew J

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: