replacing awk with perl
I want the output of this file to be in a column, not next to each ohter. I tired putting a a newline escape character in a few places, but it breaks the script. It is easy in awk, just ls -ltr | awk '{print $8 }'
casper@casper-laptop:~$ pwd
/home/casper
casper@casper-laptop:~$ ls -ltr > /tmp/outfile
casper@casper-laptop:~$ cat -n /tmp/moreawkreplace
1 #!/usr/bin/perl
2 @eighth_column;
3 while ($line =<>) {
4 push (@eighth_column, (split(/\s+/, $line))[7]);
5 }
6 print join(' ', @eighth_column);
casper@casper-laptop:~$ /tmp/moreawkreplace /tmp/outfile
this is the output:::
colemak.typ colemak-1.0 colemak-1.0.tar.gz colemak-1.0.tar Examples Templates Public Music bang.sh
|