using base name with awk


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting using base name with awk
# 1  
Old 02-22-2012
MySQL using base name with awk

Smilie

Code:
find . -type f -exec ls -l {} \; | awk '$5 $9 {print $5 $9}'

I would like $9 to be without path information, but simply the file name.
Thanks for any consideration.

Last edited by Franklin52; 02-22-2012 at 05:40 AM.. Reason: Please use code tags for code and data samples, thank you
# 2  
Old 02-22-2012
Code:
find . -type f -exec basename {} \;

This User Gave Thanks to balajesuri For This Post:
# 3  
Old 02-22-2012
Try:
Code:
awk -F'[ /]*' '$5 $NF {print $5 $NF}'

This User Gave Thanks to Scrutinizer For This Post:
# 4  
Old 02-22-2012
Please try this below command line , i am not currently in a unix box .

Code:
find . -type f -exec ls -1 {} \; | awk -F "/" '{ print $NF }'

This User Gave Thanks to codemaniac For This Post:
# 5  
Old 02-22-2012
Is there a way to have the name column along with the file byte size column have corresponding files and sizes in the same rows?

0 a
124 b
256 c
8 d
# 6  
Old 02-22-2012
Hi try this

Hi Robin,

Please try this,

Code:
find . -type f -exec ls -1 {} \; | sed 's/\(.*\)\///g' | xargs ls -l | awk '{print $4,$8;}'

with cheersSmilie,

shanmu
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk base lookup of best match strings

Hi, I'm new to scripting and unable to find out a way to perform the below task. Request help in finding out a way to accomplish this. File one consists of some numbers/string which i need to lookup against file 2 and fetch the best match results in output. If best match is not present in... (3 Replies)
Discussion started by: suraj016
3 Replies

2. Red Hat

CentOS 6.1 base install (like FreeBSD base install)?

Hello, What is the simplest way to install CentOS 6.1 with console base-system only using official LiveDVD image on VirtualBox machine? I'd like to get simplest console with network support like FreeBSD base installation. Then, install services which I need. The installer jest extracts the... (2 Replies)
Discussion started by: newbie_develope
2 Replies

3. Shell Programming and Scripting

Base 64 encoded string

Could anyone of you please give me some idea to decode base 64 encoded value in ksh? (4 Replies)
Discussion started by: nram_krishna@ya
4 Replies

4. Solaris

Missing Base Directory

Hey all, I'm attempting to migrate a zone from one system to another, but I noticed that on the new system ssl BASEDIR was missing. I was wondering if creating the directory path for this would fix the issue when I migrate files over. SSL is installed on the new system but does not show a... (1 Reply)
Discussion started by: em23
1 Replies

5. Shell Programming and Scripting

update base

hello everyone I need to update data base in file 1-ID 2-Name 3-ID group 4-ID teacher 5-mark list unique ID is (ID+ID group+ID teacher) we can append 5 th columns (marks list) main base file: 1:John:3:1:4 3 2 2:Mark:1:2:1 3 3:Susan:3:4: input file: (6 Replies)
Discussion started by: mleplawy
6 Replies

6. Shell Programming and Scripting

data base update

hello everyone I need to update data base in file 1-ID 2-Name 3-ID group 4-ID teacher 5-mark list unique ID is (ID+ID group+ID teacher) we can append 5 th columns (marks list) main base file: Code: 1:John:3:1:4 3 2 2:Mark:1:2:1 3 3:Susan:3:4: input file: (1 Reply)
Discussion started by: mleplawy
1 Replies

7. Programming

what is the base type of enum

helo i have asked in exam what that what is the base type of enum options are given bewlo (1) long int (2) short int (3) signed int (4) unsigned int can u tell me what is the exact answer from the above option Regards, Amit (1 Reply)
Discussion started by: amitpansuria
1 Replies

8. UNIX for Dummies Questions & Answers

base path on x window

Sorry that I am not good at UNIX. Please show me how to make UNIX saver name and base path to show on shell prompt. Example: Currently, my shell prompt is: $ I want it to be shown as username@savername: /u01/app/oracle > /u01/app/oracle is my user base path, I am in korne shell. ... (3 Replies)
Discussion started by: duke0001
3 Replies

9. Programming

data base

Dear sirs, I am new to DataBase in C++,Also here iam using mysql, How can do it nad get the result back from the database and do operation onit. Thanks in advance, arunkumar (2 Replies)
Discussion started by: arunkumar_mca
2 Replies

10. BSD

How is Darwin as a base For a Server

Does anyone have any Benchmarks for OS X Server in DB Serving. in comparison to Linux How bout Darwin? And How bout Darwin as a Base for a Server? How bout Ease of Environment Crossplatforms and Various Implementations? And Finally how bout Develoment? (1 Reply)
Discussion started by: RedVenim
1 Replies
Login or Register to Ask a Question