Sponsored Content
Top Forums Shell Programming and Scripting Extract date from files based on file pattern Post 302978069 by rovf on Tuesday 26th of July 2016 02:01:09 AM
Old 07-26-2016
You didn't specify, whether you need to use a particular shell, or a free to choose. For Zsh, you would get a list of the files/directories matching your pattern simply by

Code:
echo ${~$(<pattern.lst)}

However, it is not clear what you mean by "extracting the date". For example, if you have the file

Code:
file1_11470505_20160101_12121212.txt

it would certainly match the pattern file1_*.txt, but which date would you like to get? Syntactically, 11470505, 20160101 and 12121212 are all valid dates.

Last edited by rovf; 07-26-2016 at 03:01 AM.. Reason: Adding code tag
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract based on pattern

I have a mail log file and I want to extract some lines belonging to one domain. For example Input File: Dec 12 03:15:28 postfix/smtpd: 3F481EB0295: client=unknown, sasl_method=PLAIN, sasl_username=abcd@xyz.com Dec 12 03:22:08 postfix/smtpd: 60B56EE001D: client=5ad9b9ba.com,... (7 Replies)
Discussion started by: Bijayant Kumar
7 Replies

2. Shell Programming and Scripting

How to extract log data based on date

Hi Gurus, I've been having some problem in extracting the log data based on the current date and month. As shown in the sample data below, how to extract the log info for Aug 11? Sample data: root pts/ta userpc Wed Aug 11 09:46 - 20:21 (10:35) root pts/ta userpc... (13 Replies)
Discussion started by: superHonda123
13 Replies

3. Shell Programming and Scripting

Split a file into multiple files based on the input pattern

I have a file with lines something like. ...... 123_start ...... ....... 123_end .... ..... 456_start ...... ..... 456_end .... ..... 789_start .... .... 789_end (6 Replies)
Discussion started by: abinash
6 Replies

4. Shell Programming and Scripting

Splitting large file into multiple files in unix based on pattern

I need to write a shell script for below scenario My input file has data in format: qwerty0101TWE 12345 01022005 01022005 datainala alanfernanded 26 qwerty0101mXZ 12349 01022005 06022008 datainalb johngalilo 28 qwerty0101TWE 12342 01022005 07022009 datainalc hitalbert 43 qwerty0101CFG 12345... (19 Replies)
Discussion started by: jimmy12
19 Replies

5. Shell Programming and Scripting

split XML file into multiple files based on pattern

Hello, I am using awk to split a file into multiple files using command: nawk '{ if ( $1 == "<process" ) { n=split($2, arr, "\""); file=arr } print > file }' processes.xml <process name="Process1.process"> ... (3 Replies)
Discussion started by: chiru_h
3 Replies

6. Shell Programming and Scripting

Help needed - Split large file into smaller files based on pattern match

Help needed urgently please. I have a large file - a few hundred thousand lines. Sample CP START ACCOUNT 1234556 name 1 CP END ACCOUNT CP START ACCOUNT 2224444 name 1 CP END ACCOUNT CP START ACCOUNT 333344444 name 1 CP END ACCOUNT I need to split this file each time "CP START... (7 Replies)
Discussion started by: frustrated1
7 Replies

7. UNIX for Dummies Questions & Answers

Split a huge 7 GB File Based on Pattern into 4 files

Hi, I have a Huge 7 GB file which has around 1 million records, i want to split this file into 4 files to contain around 250k messages each. Please help me as Split command cannot work here as it might miss tags.. Format of the file is as below <!--###### ###### START-->... (6 Replies)
Discussion started by: KishM
6 Replies

8. UNIX for Advanced & Expert Users

Concatenation of multiple files based on file pattern

Hi, I have the following reports that get generated every 1 hour and this is my requirement: 1. 5 reports get generated every hour with the names "Report.Dddmmyy.Thhmiss.CTLR" "Report.Dddmmyy.Thhmiss.ACCD" "Report.Dddmmyy.Thhmiss.BCCD" "Report.Dddmmyy.Thhmiss.CCCD"... (1 Reply)
Discussion started by: Jesshelle David
1 Replies

9. UNIX for Beginners Questions & Answers

Extract file name based on the pattern

Hello All, I have multiple files in a hadoop /tmp/cloudera directory. Filename are as follows ABC_DATA_BAD5A_RO_F_20161104.CSV ABC_DATA_BAD6C_VR_F_20161202.CSV ABC_DATA_BAD7A_TR_F_20162104.CSV ABC_DATA_BAD2A_BR_F_20161803.CSV ABC_DATA_BAD3T_KT_F_20160106.CSV I just need filenames... (6 Replies)
Discussion started by: prajaktaraut
6 Replies

10. UNIX for Beginners Questions & Answers

Extract some characters from lines based on pattern

Hi All, i would like to get some help regarding extracting certain characters from a line grepped. blahblah{1:F01IRVTUS30XXXX0000000001}{2:I103IRVTDEF0XXXXN}{4:blah blahblah{1:F01IRVTUS30XXXX0000000001}{2:I103IRVTDEF0XXXXN}{4:blah... (10 Replies)
Discussion started by: mad man
10 Replies
UNSHIELD(1)						       http://www.synce.org						       UNSHIELD(1)

NAME
unshield - extract CAB files from an InstallShield installer archive SYNOPSIS
unshield [-c COMPONENT] [-d DIRECTORY] [-D LEVEL] [-g GROUP] [-h] [-j] [-L] [-n] [-o] [-O] [-r] [-v] [-V] c|g|l|t|x CABFILE DESCRIPTION
Unshield extracts CAB files from InstallShield installers, used to install software on Microsoft Windows based machines. OPTIONS
-c COMPONENT Only list/extract this component -d DIRECTORY Extract files to DIRECTORY -D LEVEL Set debug log level 0 - No logging (default) 1 - Errors only 2 - Errors and warnings 3 - Errors, warnings and debug messages -g GROUP Only list/extract this file group -h Show help message -j Junk paths (do not make directories) -L Make file and directory names lowercase -n Never overwrite files -o Always overwrite files -O Use old compression -r Save raw data (do not decompress) -v Be verbose -V Print version information Commands: c List components g List file groups l List files t Test files x Extract files Other: CABFILE The InstallShield installer file to act upon AUTHOR
This manual page was adapted by Mark Ellis <mark@mpellis.org.uk>, from the skeleton generated by help2man The SynCE project July 2004 UNSHIELD(1)
All times are GMT -4. The time now is 10:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy