05-13-2008
How to parse a string efficiently
I am new to the boards and to shell programming and have a requirement to name new files received with a unique sequence number. I need to look at a particular file pattern that exists and then to increment a sequence by 1 and write the new file.
Example of file names and sequence #
part1_part2_part3_datesequence.dat
or
part1_part2_part3_part4_datesequence.dat
the sequence is a 6 digit right justified 0 filled number attached to the date - 20080501000001.dat, but may be the 4th, 5th, 6th or 7th token of the filename.
I have a script that creates the new files, but I am having trouble with how to efficiently extract the sequence number in order to increment it by 1 for a given file pattern and date and then write the new file.
Any help would be appreciated and I am trying to stay with shell or sed or awk as I do not have access to perl.
thanks!
Mike
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I have a string of data that looks like this:
private.enterprises.954.1.1.1.1.1.2618 \(OctetString\): U private.enterprises.954.1.1.1.1.2.2618 \(OctetString\): 2618
I am trying to parse the string to only return the values after the ":". Ex from above "U" and "2618".
Any suggestions? (5 Replies)
Discussion started by: mnreferee
5 Replies
2. Shell Programming and Scripting
I want to get filenames from the following input. How can I parse this in bash.
input data
-------------------------------------------------------------------
path=/aaa/bbb/filename1;/aaa/filename2;/aaa/bbb/ccc/ddd/filename3
-------------------------------------------------------------------... (13 Replies)
Discussion started by: hcliff
13 Replies
3. Shell Programming and Scripting
Hi,
I am wondering if there's a simpler way to extract the second occurrence of a word enclosed in that matches my search criteria.
Sample Input is as follows:
Error installing feature - com.er.nms.cif.ist.NoMatchingUpgra
Error installing feature -... (4 Replies)
Discussion started by: racbern
4 Replies
4. UNIX for Dummies Questions & Answers
Hi Guys,
I spend half a day getting this to work with no luck, perhaps you guys can help..
I have a string from a file looking like this:
module::name=test::type=generic_data::exec=snmpget.......::desc=A Little Test::interval=300
what I would like to split it, so I get a value for each... (3 Replies)
Discussion started by: hyber
3 Replies
5. Shell Programming and Scripting
I'm working in korn shell and have a variable which contains a string like:
aa_yyyymmdd_bbb_ccc_ddd.abc. I want to treat the _ and . as delimiters and parse the string so I end up with 6 values in variables that I can manipulate. My original plan was to use
var1=`echo $sting1 | cut -c1-c2` but... (9 Replies)
Discussion started by: aquimby
9 Replies
6. Shell Programming and Scripting
Hi
I have a set of options in the form of key value in a file. Need to find a particular value of 'a' and delete all lines till the next 'a' keyword .
Ex :
a bbb
c ddd
e fff
g hhh
a sss
c ggg
e xxx
f sss
a ddd
d sss
r sss
g hhh (5 Replies)
Discussion started by: TDUser
5 Replies
7. Shell Programming and Scripting
Hi, I need to parse a string, check if there are periods and strip the string.
For example i have the following domains and subdomains: mydomain.com, dev.mydomain.com
I need to strip all periods so i have a string without periods or domain extensions: mydomain, devmydomain.
I use this for... (12 Replies)
Discussion started by: ktm
12 Replies
8. Shell Programming and Scripting
Input file
0792 to 2450 iadmssql7:
Copy:
CNJ R1:
Replication volumes:
Replication set: RSet 1
Replication size: 200.00GB
SAN Info:
200.00GB DGC VRAID CX4-960 LUN 17 (17)
RPA Port WWN Ctrl ... (0 Replies)
Discussion started by: greycells
0 Replies
9. Shell Programming and Scripting
I've a problem parsing a string as a command:
Consider script stefano.sh as following:
#!/usr/bin/sh
txtshell="./parser.sh /ews/MyEventHandler/data/handler/StopAndMail.php eventid=StopAndMail.MVIN.6300 lot_number=1122FXB facility=EWSF3 'mailto=prova.prova@nohost.com, prova.test@nohost.com'... (2 Replies)
Discussion started by: buonstefano
2 Replies
10. Shell Programming and Scripting
Hi,
I would like to be able to parse out a substring matching a basic pattern, which is a character followed by 3 or 4 digits (for example S1234 out of a larger string). The main string would just be a filename, like Thisis__the FileName_S1234_ToParse.txt. The filename isn't fixed, but the... (2 Replies)
Discussion started by: keaneMB
2 Replies
LEARN ABOUT DEBIAN
g_wheel
g_wheel(1) GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c g_wheel(1)
NAME
g_wheel - plots helical wheels
VERSION 4.5.4-dev-20110404-bc5695c
SYNOPSIS
g_wheel -f nnnice.dat -o plot.eps -[no]h -[no]version -nice int -r0 int -rot0 real -T string -[no]nn
DESCRIPTION
g_wheel plots a helical wheel representation of your sequence. The input sequence is in the .dat file where the first line contains the
number of residues and each consecutive line contains a residue name.
FILES
-f nnnice.dat Input
Generic data file
-o plot.eps Output
Encapsulated PostScript (tm) file
OTHER OPTIONS
-[no]hno
Print help info and quit
-[no]versionno
Print version info and quit
-nice int 19
Set the nicelevel
-r0 int 1
The first residue number in the sequence
-rot0 real 0
Rotate around an angle initially (90 degrees makes sense)
-T string
Plot a title in the center of the wheel (must be shorter than 10 characters, or it will overwrite the wheel)
-[no]nnyes
Toggle numbers
SEE ALSO
gromacs(7)
More information about GROMACS is available at <http://www.gromacs.org/>.
Mon 4 Apr 2011 g_wheel(1)