I run a command and pipe it through awk as below :
mycommand | awk '{print $1,tolower($3),$4}
This gives me the following output:
fred.o: t .abcdefg
fred.o: u .rstuvwxy
fred.o: t .defghi
fred.o: t .jklmnop
fred.o: d abcdefg
fred.o: d zyxwvuts
As you can see the sometimes the third column contains a leading "." but not always.
How can I modify my awk
command to get rid of the leading "." in the third column if it exists ? eg I would like my output to look like this :
fred.o: t abcdefg
fred.o: u rstuvwxy
fred.o: t defghi
fred.o: t jklmnop
fred.o: d abcdefg
fred.o: d zyxwvuts
Best Answer