LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-30-2015, 09:46 AM   #1
spatil20
LQ Newbie
 
Registered: May 2015
Posts: 21

Rep: Reputation: Disabled
Will receive two file on same date but i need to extract only one file with date like


I WILL RECEIVE TWO FILE ON SAME DATE BUT I NEED TO EXTRACT ONLY ONE FILE WITH DATE LIKE THIS ls -lrt NAV_ASDSTD10-UHC-*.txt..PLEASE HELP ME HOW TO EXTARCT
ONE FILE?
-rwxrwxrwx 1 aaaaa eeeee 79 Jun 30 02:42 NAV_ASDSTD10-UHC-20150616_trailer.txt
-rwxr-xr-x 1 aaaaa eeeee 29907792 Jun 30 09:24 NAV_ASDSTD10-UHC-20150616.txt

Last edited by spatil20; 06-30-2015 at 09:49 AM. Reason: file name is not correct
 
Old 06-30-2015, 09:54 AM   #2
ttk
Senior Member
 
Registered: May 2012
Location: Sebastopol, CA
Distribution: Slackware64
Posts: 1,038
Blog Entries: 27

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Those files have different names. Is there a reason you cannot extract the file by name?

More explanation of your situation would help us provide you with better advice.
 
Old 06-30-2015, 09:57 AM   #3
spatil20
LQ Newbie
 
Registered: May 2015
Posts: 21

Original Poster
Rep: Reputation: Disabled
I st file:- NAV_ASDSTD10-UHC-20150616_trailer.txt II nd file:-NAV_ASDSTD10-UHC-20150616.txt...diff is _trailer.txt and .txt...I need 2nd file
 
Old 06-30-2015, 10:27 AM   #4
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
Code:
cat NAV_ASDSTD10-UHC-20150616.txt
?

edit: maybe generically:
Code:
cat *[0-9][0-9][0-9][0-9][0-1][0-9][0-3][0-9].txt
?

Last edited by schneidz; 06-30-2015 at 02:35 PM.
 
Old 06-30-2015, 10:33 AM   #5
spatil20
LQ Newbie
 
Registered: May 2015
Posts: 21

Original Poster
Rep: Reputation: Disabled
cat NAV_ASDSTD10-UHC-20150616.txt
cat NAV_ASDSTD10-UHC-20150616_trailer.txt...

2 diff file with same date but I want only .txt file not contain "_trailer.txt" in my ls command.
 
Old 06-30-2015, 02:35 PM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
if you really dont want the NAV_ASDSTD10-UHC-20150616_trailer.txt file, is it possible for you to delete it ?

sorry, you are not really explaining yourself very well.

edit: is this what you want:
Code:
ls -lrt NAV_ASDSTD10-UHC-*[0-9][0-9][0-9][0-9][0-1][0-9][0-3][0-9].txt
http://www.linuxquestions.org/questi...8/#post5385090
?

Last edited by schneidz; 06-30-2015 at 02:40 PM.
 
1 members found this post helpful.
Old 06-30-2015, 10:52 PM   #7
spatil20
LQ Newbie
 
Registered: May 2015
Posts: 21

Original Poster
Rep: Reputation: Disabled
it is working ,what is the meaning of -*[0-9][0-9][0-9][0-9][0-1][0-9][0-3][0-9].txt?
 
Old 07-01-2015, 01:16 AM   #8
ttk
Senior Member
 
Registered: May 2012
Location: Sebastopol, CA
Distribution: Slackware64
Posts: 1,038
Blog Entries: 27

Rep: Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484Reputation: 1484
Quote:
Originally Posted by spatil20 View Post
it is working ,what is the meaning of -*[0-9][0-9][0-9][0-9][0-1][0-9][0-3][0-9].txt?
This explains it:

https://en.wikipedia.org/wiki/Glob_%28programming%29

Read it.
 
1 members found this post helpful.
  


Reply

Tags
receive



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract date from file rohit_shinez Programming 2 10-02-2014 11:42 PM
[SOLVED] BASH: Keep original mod date of a file and 'date' it back to same file? SilversleevesX Programming 4 07-16-2010 11:12 AM
[SOLVED] Use date with touch to create new file with date based name craigjl Linux - Newbie 5 03-12-2010 09:46 AM
[SOLVED] extract modification date of file as yyyymmdd thelordmule Other *NIX 3 07-11-2009 02:28 AM
shell script to find modified date and last accessed date of any file. parasdua Linux - Newbie 6 04-22-2008 09:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration