Hi I have one log file which containt output of ls command. I want to read that file content and get the file name and size then I have to check that if that file size is zero then touch that file locally other wise get that file from ftp.
log file contents are(FileName is filelist.txt):
unknown security mechanism unknown security mechanism Passive mode off. -rwxr----- 1 smartscm System 761 Jun 18 2008 APPayment20080618123001.csv -rwxr----- 1 smartscm System 0 Jun 19 2008 APPayment20080619123000.csv -rwxr----- 1 smartscm System 0 Jun 25 2008 APPayment20080625123001.csv -rwxr----- 1 smartscm System 1961 Jun 30 2008 APPayment20080630123001.csv
How i can read the filename and size? I want to read filename in loop so I can check the size condition and get the file from FTP accd. to condition.
The awk utility is good for this. So are a number of other common system scripting utilities, including raw script programming and perl, but in this case, the awk solution is probably the simplest. You'd just set up a pattern to match only the "ls" output lines and then use awk's builtin field-parsing abilities to extract the values.
Customer surveys are for companies who didn't pay proper attention to begin with.