GaijinPunch
MIS
Haven't played with bash in a while. I'm actually writing a Perl script and using a bash command to get my input. Instead of using some goofy subroutine to find out what the newest file is, I'm trying to do a directory listing, grep out the files I want to see (in reverse order) tail by 1 so I get the latest file, and then I want to cat out the contents.
I'm doing all of this in a RSH command, and to top it off (as stated before), that command is actually going into a filehandle in perl, so this needs to be a one-liner. I tried
rsh nodename ls -tr /path/to/dir |grep "string" |tail -1
which gives me the file. When I try
rsh nodename ls -tr /path/to/dir |grep "string" |tail -1 |cat
then I still get the file name -- it doesn't cat the contents.
Any help is appreciated.
I'm doing all of this in a RSH command, and to top it off (as stated before), that command is actually going into a filehandle in perl, so this needs to be a one-liner. I tried
rsh nodename ls -tr /path/to/dir |grep "string" |tail -1
which gives me the file. When I try
rsh nodename ls -tr /path/to/dir |grep "string" |tail -1 |cat
then I still get the file name -- it doesn't cat the contents.
Any help is appreciated.