Required unix command!!!

Hi,

In a file I have data like...

-rw-r----- 1 ftpuser users 1036695 Jul 6 14:59 ./APRIL 2007/Ujjain/My Disc (D)/9565DW07.04B
-rw-r----- 1 ftpuser users 124080 Jul 6 14:59 ./APRIL 2007/Vadodara/vad_APRIL07/2082DW07.04B

The above data is extracted using "find . -name 4704DW07.03B -print > file1"

I want to generate output from the file like
1036695,9565DW07.04B
124080,2082DW07.04B

can anybody give me a command to do the same(without shell scripts).

Thanking you in advance,
Ronald.

awk '{print $5","basename ($9)}' datafile

Hi,

I'm getting following result

#cat file1 | awk '{print $5","basename($9)}'
awk: Function basename is not defined.
The input line number is 1.
The source line number is 1.

Regards,
Ronald.

Hi,

Also please note I have files like
-rw-r----- 1 ftpuser users 348738 Jul 6 14:38 ./APRIL 2007/patna/4976DW07.04B

i.e. between APRIL 2007, there is a space.

Regards,
Ronald.

$ cat file
-rw-r----- 1 ftpuser users 1036695 Jul 6 14:59 ./APRIL 2007/Ujjain/My Disc (D)/9565DW07.04B
-rw-r----- 1 ftpuser users 124080 Jul 6 14:59 ./APRIL 2007
$ awk -F"[ /]" ' { print $5 "," $NF } ' file
1036695,9565DW07.04B
124080,2082DW07.04B

Hi,

Thanks for your response. In some cases it works.

In the following case
[devofsa]:/db01/BOIDW_FEED_DIR/BOIDW_FTP_DIR/cibex#cat file2
-rw-r----- 1 ftpuser users 249384 Jul 6 14:38 ./APRIL 2007/patna/4975DW07.04B
-rw-r----- 1 ftpuser users 348738 Jul 6 14:38 ./APRIL 2007/patna/4976DW07.04B

[devofsa]:/db01/BOIDW_FEED_DIR/BOIDW_FTP_DIR/cibex#cat file2 | awk -F"[ /]" ' { print $5 "," $NF } '
ftpuser,4975DW07.04B
ftpuser,4976DW07.04B

Is there something wrong. in this case instead of user I want size!

Ronald.

I dont find any wrong here. Check whether that line contain non-printable characters

Hi,

Thanks for your reply.

I found the mistake. You dont take the data I have given, instead make a "ls -l > file1" and try with

cat file1 | awk -F"[ /]" ' { print $5 "," $NF } ' 

It does not give the desired output. becuase between $1 and $2 there are many spaces, that is why it takes as different columns. Since the size of the file varies I can not take a fixed column.

Is there a way for this

Ronald.

sed 's;.*/;;' input_file

Hi,

Its worked perfectly.

Along with that, i want the Size column also.
like
1036695,9565DW07.04B
124080,2082DW07.04B

Ronald.

awk '{print $NF,$5}' <file-name>|cut -d"/" -f3|awk '{print $2 "," $1}'

Hi everybody,

I could make it work like this.

ls -l `find . -name *DW07.04B -print` | sed "s/ *[ ]/ /g" | awk -F"[ /]" ' { print $5 "," $NF } ' > file3

Thanks everybody.

Ronald.

Ronald,
Next time, try to specify all requirements at first.
A lot of times, a so called 'simple' change can mean a total rewrite
or complication of the solution.