Sponsored Content
Top Forums Shell Programming and Scripting parsing filename and grabbing specific string patterns Post 302498259 by rdcwayx on Sunday 20th of February 2011 07:44:36 PM
Old 02-20-2011
Quote:
Originally Posted by rukasetsuna

The solution works for the example you gave but doesnt work for the other cases....Thanks a lot though :-)

Ruk
fixed.

Code:
$ echo testfile_string3_string4.csv |sed 's/^[^_]*_//;s/_[0-9][^_]*\./\./'
string3_string4.csv

$ echo testfile_string1_string2_string3_20100232to201130203.csv |sed 's/^[^_]*_//;s/_[0-9][^_]*\./\./'
string1_string2_string3.csv


Last edited by rdcwayx; 02-20-2011 at 09:14 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filename Patterns in mget

I was writing a shell script for FTPing files for a machine. now i am facing a problem in it. The problem is i want to ftp files which do not end with a particular pattern. The pattern is file should not end with .dd ( d=digit ) for eg: say i have files file file.01 file.02 ... (0 Replies)
Discussion started by: dipendra_g
0 Replies

2. Shell Programming and Scripting

Parsing string using specific delimiter

Hi, I'm wondering what is the best way to parse out a long string that has a specific deliminator and outputting each token between the delim on a newline? i.e. input text1,text2,text3,tex4 i.e. output text1 text2 text3 text4 (8 Replies)
Discussion started by: primp
8 Replies

3. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies

4. Shell Programming and Scripting

grabbing specific column perl

Alright, I'm new to Perl so be gentle. Given the following script: ---- open(file, "<file.txt"); @lines = <file>; close(file); $var = print $lines; ---- So I'm printing line 18 of the file "file.txt". I now want the 5th column, minus the forward slash. The line looks like this: ... (2 Replies)
Discussion started by: wxornot
2 Replies

5. Shell Programming and Scripting

grabbing filename from text file....should be easy!

Quick question...I'm trying to grab the .tif file name from this output from our fax server. What is the best way i can do this in a bash script? I have been looking at regular expressions with bash or using awk but having some trouble. thanks! The only output i want is... (5 Replies)
Discussion started by: kuliksco
5 Replies

6. UNIX for Dummies Questions & Answers

replace multiple patterns in a string/filename

This should be somewhat simple, but I need some help with this one. I have a bunch of files with tags on the end like so... Filename {tag1}.ext Filename2 {tag1} {tag2}.ext I want to hold in a variable just the filename with all the " {tag}" removed. The tag can be anything so I'm looking... (4 Replies)
Discussion started by: kerppz
4 Replies

7. Shell Programming and Scripting

Help parsing filename with bash script

Hi all! Looking for some help parsing filenames in bash. I have a directory full of files named "livingroom-110111105637.avi". The format is always date and time (yymmddhhmmss). I'm looking to parse the filenames so they are a little more easily readable. Maybe rename them to... (4 Replies)
Discussion started by: mtehonica
4 Replies

8. Shell Programming and Scripting

Html parsing - get line after specific string till a point

Hi all :) It sounds complex, for example I want to find the whole html file (there are 5 entries of this string and I need to get all of them) for the string "<td class="contentheading" width="100%">", get the next line from it only till the point that says "</td>", plus removing \t (tabs) ... (6 Replies)
Discussion started by: hakermania
6 Replies

9. Shell Programming and Scripting

Specific string parsing in Linux/UNIX

Hi, I have a string which can be completely unstructred. I am looking to parse out values within that String. Here is an example <Random Strings> String1=<some number a> String2=<some number b> String3=<some number c> Satish=<some number d> String4=<some number e> I only want to parse out... (1 Reply)
Discussion started by: satishrao
1 Replies

10. Shell Programming and Scripting

Parsing a file with different patterns

I have a text file like this , where the same set of three lines repeat with different values. INFO: processing now 03/25/2015-00:06:05 03/25/2015-00:16:04 ------Invoking myexe table=table1 INFO 25-03 00:20:26,801 - Finished processing (I=0, O=57, R=57, W=57, U=0, E=0) INFO: processing... (4 Replies)
Discussion started by: Lakshmikumari
4 Replies
gnome-cleanup(1)						   User Commands						  gnome-cleanup(1)

NAME
gnome-cleanup - cleans GNOME user preferences SYNOPSIS
gnome-cleanup user DESCRIPTION
gnome-cleanup erases all GNOME user preferences, returning the user to the default look and feel. This can be used to undo undesired pref- erence settings, or to correct the desktop if the preferences become corrupt. The GNOME preference files are automatically recreated the next time the user logs into a GNOME session. By default this program erases the configuration files for the user running the command. However, a different user can be specified on the command line. Of course, configuration files are only erased if the user running gnome- cleanup has appropriate file permissions to erase the user's configuration files. gnome-cleanup will display a listing of all preference files that it will erase before erasing any files, and prompts the user to confirm that they would like to erase these files. Files are erase only after receiving a positive confirmation from the user. gnome-cleanup cannot be run while logged into a GNOME session. Users should run this program when logged into another session, for exam- ple, the Failsafe session. If the user tries to run this program while already logged into GNOME, an error message is displayed. OPTIONS
None. OPERANDS
The following operands are supported: user Specify the user whose configuration files will be erased. The files will only be erased if the user running gnome-cleanup has file permissions to erase the user's configuration files. This is useful, for example, if you want to run the script as the root user to erase the configuration files for a specific user. If user is not specified, the user is the same as the user who runs the gnome-cleanup command. EXAMPLES
Example 1: Erase GNOME user preferences example% gnome-cleanup After displaying a list of preference files that will be erase, the following question is displayed: Do you wish to remove these files (Y/N) The files are erase only if the user provides a positive response. EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/gnome-cleanup Executable for GNOME cleanup. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-panel | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
attributes(5) NOTES
Written by Brian Cameron, Sun Microsystems Inc., 2003, 2007. SunOS 5.11 27 Nov 2007 gnome-cleanup(1)
All times are GMT -4. The time now is 03:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy