Sponsored Content
Full Discussion: get filenames from log
Top Forums Shell Programming and Scripting get filenames from log Post 302692117 by Hekm on Monday 27th of August 2012 06:53:42 AM
Old 08-27-2012
get filenames from log

Hi.

I'm trying to get the names of files from a log file, without the path and special characters.
I have a file that contains lines like this:
Code:
'/path/to/files/file00010000070874.EXT'
'/path/to/files/file00010000070875.EXT'
'/path/to/files/file00010000070876.EXT'
'/path/to/files/file00010000070877.EXT'
'/path/to/files/file00010000070878.EXT'
'/path/to/files/file00010000070879.EXT'
'/path/to/files/file00010000070880.EXT'
'/path/to/files/file00010000070881.EXT'
'/path/to/files/file00010000070882.EXT'
'/path/to/files/file00010000070883.EXT'

I would like to create a file from this that contains only the file names like this:
Code:
file00010000070874.EXT
file00010000070875.EXT
file00010000070876.EXT
file00010000070877.EXT
file00010000070878.EXT
file00010000070879.EXT
file00010000070880.EXT
file00010000070881.EXT
file00010000070882.EXT
file00010000070883.EXT

The path is usually the same but the file name may vary only the extension and the beginning of the name is the same.

For the moment I'm using cut but that is not an elegant solution and if the file names aren't the same I would always have to adjust the script.

Thanks in advance.

Last edited by Franklin52; 08-27-2012 at 08:16 AM.. Reason: Please use code tags for data and code samples
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

prefixing filenames

Hi,:cool: I have a list of files in a directory.I need to store them in a file with the prefix of @ by using a command.. ex:@p_po.plb @p_ebiz_roster_data.plb any idea pls. cheers RRK (2 Replies)
Discussion started by: ravi raj kumar
2 Replies

2. Shell Programming and Scripting

Patterns in Filenames

Hi, To start, I am using a bash shell on a G4 powerbook running Leopard. I am attempting to write a shell script that will automate the processing of satellite imagery. All the filenames are of the following construction: A2008196000500.L2 where A indicates the sensor, the next four... (6 Replies)
Discussion started by: msb65
6 Replies

3. Shell Programming and Scripting

spaces in filenames

Hi I hope someone will be able to resolve this little teaser! I am running a script for file in `ls directory` do echo "$file" ...other code here.... done this works fine unless we receive a file with a name which has a space in it ie "filena me" (I know its not good... (8 Replies)
Discussion started by: Bab00shka
8 Replies

4. UNIX for Dummies Questions & Answers

parsing filenames

How can I loose a part of the filename I want to drop the “_<Number>.sql” Below I have a listing of file names in a file Eg : CREDIT_DEL_033333.sql I want it to be CREDIT_DEL ATM_DEBIT_CARD_0999999.sql I want it to be ... (3 Replies)
Discussion started by: jville
3 Replies

5. Programming

Unicode filenames in C++?

I'm trying to figure out how to support Unicode or atleast an unsigned char in the d_name of struct dirent The problem i'm facing is that I'm checking file names for special characters and obviously the "char d_name" doesn't like it. I'm looping through the directory and getting the file... (3 Replies)
Discussion started by: james2432
3 Replies

6. UNIX for Dummies Questions & Answers

renaming filenames

I have 7 files with 7 different names coming into a specified folder on weekly basis, i need to pick a file one after another and load into oracle table using sql loader. I am using ksh to do this. So in the process if the file has error records and if sql loader fails to load into oracle tables,... (0 Replies)
Discussion started by: vpv0002
0 Replies

7. Shell Programming and Scripting

Manipulating Filenames

Hi Folks, I'm looking for some ideas on how to change some file names. I'm pretty sure I need to use sed or awk but they still escape me. The files I have are like: VOD0615 NEW Blades R77307.pdf or VOD0615_NEW_Blades_R77307.pdf and what I want after processing is: R77307 NEW Blades.pdf ... (5 Replies)
Discussion started by: imonkey
5 Replies

8. Slackware

cp does not like filenames with accents?

Hi: mkisofs -graft-points -rational-rock -joliet -joliet-long -full-iso9660-filenames -iso-level 2 -o /tmp/image.iso STORE1/=/almacen/strauss In /almacen/strauss there are filenames containing not only spaces but accented characters as well. I burned the image to DVD, with the result that all... (2 Replies)
Discussion started by: stf92
2 Replies

9. Shell Programming and Scripting

Parsing FileNames

Hi, Its been a long time since I've done any shell scripting and I need some help here. Thanks in advance... I need this as a bourne or csh script running under SCO. In a folder I have a list of Backup files named with "TarBackup plus a date and time component suffix" like this; ... (2 Replies)
Discussion started by: stanlyn
2 Replies

10. UNIX for Beginners Questions & Answers

Sort the filenames

Hello Unix experts: I have dir where few files are there, i want to sort these files and write the output to some other file but i need filenames with filepath too eg: i have filenames like 010020001_S-FOR-Sort-SYEXC_20171218_094256_0004.txt so i want to sort my files on first 5 fields of... (2 Replies)
Discussion started by: gnnsprapa
2 Replies
GPIV_SERIES(1)						      General Commands Manual						    GPIV_SERIES(1)

NAME
gpiv_series - Script for (parallel) processing a series of numbered files. SYNOPSIS
gpiv_series [-a | --arg_n] [-b | --basename FILE] [-e | --ext ext] [-f | --first N] [-l | --last N] [-i | --incr N] [-x|| --prefix] [-h | --help] [-n | --none] [-p | --print] [--pad] "process -key1 ..." DESCRIPTION
gpiv_series processes a series of numbered files. If no parameters are defined at the command line, standard parameters will be used that are defined in the script. Principally, any program or script may be invoked by gpiv_series. "Process" is a string which represents the name of the program to be executed, including eventually command line options and arguments. The file to be processed, as constructed from -b c.s., will be appended to the "process" string. If the program has to be feeded with -f "filename", write -f at the end of the string. When using the parallelised version, mpipython is invoked and the script may be launched with mpirun. The script needs that all input files are accessible on each node by copying all data or by (NFS) mounting the File System containing the input data on each node. This program does not use the parameter resources from libgpiv. Options -a | --arg_n If the process needs the current number in its argument list instead of prepending/appending it to the FILE, the number will be put before (-f) filename in the "process" string. -b | --basename FILE The FILE has to be given without its extension. FILE represents the file name without its number. It is supposed that the leading or ending number in the filename is the counter that will be applied by gpiv_series when processing. -e | --ext EXT add an extension EXT after the filename (without the leading ".") in "process". -f | --first N Defines the counter N of the number at which the analyses starts. Default: 0. -l | --last N The last number N that will be processed. Default: 0. -i | --incr N Increment number with N. Default: 1. This might be useful, for example, if subsequent numbered images are combined for cross-corre- lation with the gpiv_img2gpiv tool. -x | --prefix Use prefix numbering to file basename. -h | --help On-line help. -n | --none Suppresses real execution, only prints the process to stdout. -p | --print Prints the process to be performed on each file to stdout. --pad N Padding a number with N zero's when combining with the filename. SEE ALSO gpivtools NOTES
AUTHOR
Gerber Van der Graaf BUGS
The parallelised script has only been tested with the LAM version of mpipython. 19 Januari 2005 GPIV_SERIES(1)
All times are GMT -4. The time now is 01:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy