The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Help Required: Command to find IP address and command executed of a user loggedout Security 2 08-06-2008 08:12 PM
help required in unix command/script thaduka UNIX for Advanced & Expert Users 1 10-18-2005 02:27 AM
Unix command help required thaduka UNIX for Dummies Questions & Answers 7 10-17-2005 03:24 PM
Help Required in Unix Command thaduka UNIX for Dummies Questions & Answers 2 08-25-2005 11:12 PM
unix command required. nowayin SUN Solaris 1 05-19-2004 01:03 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 07-06-2007
ronald_brayan ronald_brayan is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 33
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.
  #2 (permalink)  
Old 07-06-2007
lorcan lorcan is offline
Registered User
  
 

Join Date: May 2007
Posts: 219
Code:
awk '{print $5","basename ($9)}' datafile
  #3 (permalink)  
Old 07-06-2007
ronald_brayan ronald_brayan is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 33
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.
  #4 (permalink)  
Old 07-06-2007
ronald_brayan ronald_brayan is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 33
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.
  #5 (permalink)  
Old 07-06-2007
anbu23 anbu23 is offline Forum Advisor  
Registered User
  
 

Join Date: Mar 2006
Location: Bangalore,India
Posts: 1,398
Quote:
Originally Posted by ronald_brayan View Post
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.
Code:
$ 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
  #6 (permalink)  
Old 07-06-2007
ronald_brayan ronald_brayan is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 33
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:15 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0