Few queries regarding awk...


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Few queries regarding awk...
# 1  
Old 12-23-2011
Few queries regarding awk...

One of the command output is as below.

Code:
-rw-r--r--+ 1 root root 75G Nov 21 16:43 /var/ovs/mount/86BXXX/running_pool/Machine1/System-sda.img
-rw-r--r--+ 1 root root 75G Nov 21 16:36 /var/ovs/mount/86BXXX/running_pool/Machine2/System.img
-rw-r--r--+ 1 root root 150G Sep 23 19:13 /var/ovs/mount/86BXXX/running_pool/Machine3/System-hda.img

How would i filter it to get output like this.

Code:
Machine1 21 Nov
Machine2 21 Nov
Machine3 23 Sep

I m using awk but dont know how to deal with two delimiters i.e. space and /.
# 2  
Old 12-23-2011
Code:
nawk -F"[ /]" '{print $15,$7,$6}' yourfile

or

Code:
yourcommand | nawk -F"[ /]" '{print $15,$7,$6}'

# 3  
Old 12-23-2011
Another way

Code:
command  | awk '{n=split($NF,A,"/");print A[n-1],$7,$6}'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

/etc/motd - queries

If I have /etc/motd, he is file or directory? I saw that some call them folders and files others... Which option is better? I knew that being a director, but many told me not. Thank you! (1 Reply)
Discussion started by: mescu
1 Replies

2. Debian

GRUB Queries ?!

Hello, I am posting the following questions here because I need them answered by people who have actually done a lot of work in GRUB. DO NOT GIVE ME GUESS ANSWERS PLEASE. Feel free to redirect me if this is not the right place to ask these questions. Can I download GRUB separately from... (6 Replies)
Discussion started by: sreyan32
6 Replies

3. AIX

Queries Regarding MigratePV

We have 3PVs, now we want to migrate it to new 2PVs. OLD PVS hdisk1 ---- /u01 hdisk2 ------ /u01 hdisk 3 ----- /u02, /u01 new PVs hdisk4 ---- Free hdisk5 ---- Free I check man, it doesn't say anything about offline/online thing, do i need downtime to migrate pv ? also, what i... (6 Replies)
Discussion started by: Fracker
6 Replies

4. UNIX for Advanced & Expert Users

How many DNS queries

Is there any way to see how many queries come into our external DNS server? In looking at DNS providers, most of them base pricing on number of queries per month so I just wanted to see if you had any idea/way of gathering that data? A rough ballpark figure would even work. Our DNS server is... (1 Reply)
Discussion started by: raggmopp
1 Replies

5. UNIX for Advanced & Expert Users

awk script queries

Hi, First query: I am trying to execute the below command to pull all the record whose length is not of the expected. But this is not giving the expected results. $2 is the record length passed in the script as second parameter.$filename is the filename on which the awk is executed.It is... (4 Replies)
Discussion started by: devina
4 Replies

6. UNIX for Dummies Questions & Answers

Help with BASH/AWK queries ....

Hi Everyone, I have an input file in the following format: score.file1.txt contig00045 length=566 numreads=19 1047 0.0 contig00055 length=524 numreads=7 793 0.0 contig00052 length=535 numreads=10 607 e-176 contig00072 length=472 numreads=46 571 e-165... (8 Replies)
Discussion started by: Fahmida
8 Replies

7. Solaris

Installation queries

Dear All, Please clarify my queries My 1st doubt is as you know solaris have default 8 slices out of 8 slices in which slice the OS is stored. Like in windows if you select C drive the Program files are stored in C drive like that in solaris in which slice the OS is stored. My 2nd doubt is... (2 Replies)
Discussion started by: suneelieg
2 Replies

8. Homework & Coursework Questions

Queries

Any help on like where to get started on this? I'm just confused. 1. The problem statement, all variables and given/known data: Enter text here.Queries to satisfy these two report requests (use your CCI database): Retrieve all rows of active inventory where current on hands is less than... (0 Replies)
Discussion started by: lakers34kb
0 Replies

9. Shell Programming and Scripting

my queries

hi guys Well, i need to have a report generation script or any script which will show me all the content/information of a file when i run that script. Please help me on this isssue at the earliest.As i am little bit aware of scripting.Thanks in advance! regards ash (4 Replies)
Discussion started by: whizkidash
4 Replies

10. UNIX for Advanced & Expert Users

Some queries...

Guys need some advice on how to check some of the questions below? i'm running on an open VMS platform... which i am an idiot to... appreciate if anyone can give some hints or source on how to check on.. a script that is running on cron job... but doesn't run as the login user name.. 1. why... (6 Replies)
Discussion started by: 12yearold
6 Replies
Login or Register to Ask a Question