If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Unix Shell Scripts > awk command

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-21-06, 11:01
pavan_test pavan_test is offline
Registered User
 
Join Date: Oct 2005
Posts: 45
awk command

Hi all.,

i am working on script.

I have a file. i type ls -ltr and i get

-rwxrwx--- 1 pavi C2052EX 15 Mar 21 09:50 START.TTN.20060321.095017.ctl_20060321095032

( pls note everything is in 1 line, here it came in 2 lines.)

I have to use awk command and only get the MAR 21 to be displayed in the out.it is tab delimited.

can anyone help me please how can i do it using awk

thanks
pavi
Reply With Quote
  #2 (permalink)  
Old 03-21-06, 14:39
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool


Try:
Code:
ls -ltr|nawk '/Mar 21/ {print $6,$7;}'

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
  #3 (permalink)  
Old 03-21-06, 22:48
bhaizone bhaizone is offline
Registered User
 
Join Date: Feb 2006
Posts: 31
ls -ltr | awk 'BEGIN{/Mar 21/} {print $6,$7;}'
Reply With Quote
  #4 (permalink)  
Old 03-22-06, 17:16
LKBrwn_DBA LKBrwn_DBA is offline
Registered User
 
Join Date: Jun 2003
Location: West Palm Beach, FL
Posts: 2,456
Cool


But what is the use of displaying only the date?
Maybe you want to display the file name:
Code:
ls -ltr|awk '/Mar 21/ {print $9;}'

__________________
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On