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




Thread: Date value
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-10-2009
akil akil is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 50
Date value

Hi
I want to grab date filed value in the below file

Code:
file120081218-153431-630.csv

Expecting 
20081218

I have tried this ,but not able get datae field

ls -lrt file120081218-153431-630.csv|awk '{print $9}'|tr "_" " "|awk '{print substr($2,1,1,(index($2,"-")-1))}'|awk '{print substr($0,-8)}'
Thanks in advance ,
Akil