02-17-2008
parse through one text file and output many
Hi, everyone
The input file pattern is like below:
Begin Object1
txt1
end
;
Begin Object2
txt2
end
;
...
I want to parse this one file into Object1.txt, Obeject2.txt... each contains one statement from 'Begin' to ';' , e.g. object1.txt contains:
Begin object1
txt1
end
;
---------------------------
Any thoughts?
also, Questions
1. any AWK or SED can search for a pattern across many lines?
2. how can I output many files?
3. Shall I move this thread to "Shell Programming and Scripting"?
Thank you in advance
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Please help.
I have a text file which looks something like this
aaa@abc.com, c:FilePath\Eaaa.txt
bbb@abc.com, c:FilePath\Ebbb.txt
ccc@abc.com, c:FilePath\Eccc.txt
ddd@abc.com, c:FilePath\Eddd.txt...so on
I want to write a shell script which will pick up the first field 'aaa@abc.com' and... (12 Replies)
Discussion started by: Amruta Pitkar
12 Replies
2. Shell Programming and Scripting
i am attempting to parse a simple text file with multiple lines and four fields in each line, formatted as such:
12/10/2006 12:34:06 77 38
this is what i'm having problems with in my bash script:
sed '1,6d' $RAWDATA > $NEWFILE
#removes first 6 lines from file, which are... (3 Replies)
Discussion started by: klick81
3 Replies
3. Shell Programming and Scripting
I have a file that has a header followed by 8 columns of data. I want to toss out the header, and then write the data to another file with a different header and footer. I also need to grab the first values of the first and second column to put in the header.
How do I chop off the header? ... (9 Replies)
Discussion started by: craggm
9 Replies
4. UNIX for Advanced & Expert Users
I have one file say CM.txt which contains values like below.Its just a flat file
1000,A,X
1001,B,Y
1002,B,Z
...
..
total around 4 million lines of entries will be in that file.
Now i need to write another file CM1.txt which should have
1000,1
1001,2
1002,3
....
...
..
Here i... (6 Replies)
Discussion started by: sivasu.india
6 Replies
5. Shell Programming and Scripting
I have a file, not really a csv, but containing delineated data just the same. Lets call that file "raw_data.txt". It contains data in the format of company name:fein number like this:
first company name:123456789
second company name:987654321
what i need to do is read this file, apply... (11 Replies)
Discussion started by: FreddyG
11 Replies
6. Shell Programming and Scripting
Hello,
I'm new to shell scripting and did a search on the forum to what I want to do but couldn't find anything.
I have about 9 routers that outputs to 1 syslog file daily named cisco.year.mo.date.log ex: cisco.2009.05.11.log
My goal is to make a parsing script that cats today's syslog... (2 Replies)
Discussion started by: jjrambar
2 Replies
7. Shell Programming and Scripting
I have a file name version.properties with the following data:
major.version=14
minor.version=234
I'm trying to write a grep expression to only put "14" to stdout. The following is not working.
grep "major.version=(+)" version.properties
What am I doing wrong? (6 Replies)
Discussion started by: obfunkhouser
6 Replies
8. Shell Programming and Scripting
I wanted to parse a text file and join in specific format. please suggest me how to get this done..
The output should be in fasta format which consists of lines starting with ID, PT, PA and Sequence. "//" the two slashes are dividing lines between two different sequences.
Like... (10 Replies)
Discussion started by: empyrean
10 Replies
9. Shell Programming and Scripting
I have a file of ~500,000 entries in the following:
file.txt
chr1 11868 12227 ENSG00000223972.5 . + HAVANA exon . gene_id "ENSG00000223972.5"; transcript_id "ENST00000456328.2"; gene_type "transcribed_unprocessed_pseudogene"; gene_status "KNOWN"; gene_name "DDX11L1"; transcript_type... (17 Replies)
Discussion started by: cmccabe
17 Replies
10. Shell Programming and Scripting
My source file looks like this:
Cust-Number = "101"
Cust-Name="Joe"
Cust-Town="London"
Cust-hobby="tennis"
Cust-purchase="200"
Cust-Number = "102"
Cust-Name="Mary"
Cust-Town="Newyork"
Cust-hobby="reading"
Cust-purchase="125"
Now I want to parse this file (leaving out hobby) and... (10 Replies)
Discussion started by: Balav
10 Replies
LEARN ABOUT ULTRIX
groff_me
GROFF_ME(7) Miscellaneous Information Manual GROFF_ME(7)
NAME
groff_me - troff macros for formatting papers
SYNOPSIS
groff -me [ options ] file ...
groff -m me [ options ] file ...
DESCRIPTION
This manual page describes the GNU version of the -me macros, which is part of the groff document formatting system. This version can be
used with both GNU troff and Unix troff. This package of troff macro definitions provides a canned formatting facility for technical
papers in various formats.
The macro requests are defined below. Many troff requests are unsafe in conjunction with this package, however, these requests may be used
with impunity after the first .pp:
.bp begin new page
.br break output line here
.sp n insert n spacing lines
.ls n (line spacing) n=1 single, n=2 double space
.na no alignment of right margin
.ce n center next n lines
.ul n underline next n lines
Output of the pic, eqn, refer, and tbl preprocessors is acceptable as input.
FILES
/usr/share/groff/1.21/tmac/me.tmac (a wrapper file for e.tmac)
/usr/share/groff/1.21/tmac/e.tmac
SEE ALSO
groff(1), troff(1)
-me Reference Manual, Eric P. Allman
Writing Papers with Groff Using -me
REQUESTS
This list is incomplete; see The -me Reference Manual for interesting details.
Request Initial Cause Explanation
Value Break
.(c - yes Begin centered block
.(d - no Begin delayed text
.(f - no Begin footnote
.(l - yes Begin list
.(q - yes Begin major quote
.(x x - no Begin indexed item in index x
.(z - no Begin floating keep
.)c - yes End centered block
.)d - yes End delayed text
.)f - yes End footnote
.)l - yes End list
.)q - yes End major quote
.)x - yes End index item
.)z - yes End floating keep
.++ m H - no Define paper section. m defines the part of the paper, and can be C (chapter), A (appendix), P (preliminary, e.g.,
abstract, table of contents, etc.), B (bibliography), RC (chapters renumbered from page one each chapter), or RA (ap-
pendix renumbered from page one).
.+c T - yes Begin chapter (or appendix, etc., as set by .++). T is the chapter title.
.1c 1 yes One column format on a new page.
.2c 1 yes Two column format.
.EN - yes Space after equation produced by eqn or neqn.
.EQ x y - yes Precede equation; break out and add space. Equation number is y. The optional argument x may be I to indent equation
(default), L to left-adjust the equation, or C to center the equation.
.GE - yes End gremlin picture.
.GS - yes Begin gremlin picture.
.PE - yes End pic picture.
.PS - yes Begin pic picture.
.TE - yes End table.
.TH - yes End heading section of table.
.TS x - yes Begin table; if x is H table has repeated heading.
.b x no no Print x in boldface; if no argument switch to boldface.
.ba +n 0 yes Augments the base indent by n. This indent is used to set the indent on regular text (like paragraphs).
.bc no yes Begin new column
.bi x no no Print x in bold italics (nofill only)
.bu - yes Begin bulleted paragraph
.bx x no no Print x in a box (nofill only).
.ef 'x'y'z' '''' no Set even footer to x y z
.eh 'x'y'z' '''' no Set even header to x y z
.fo 'x'y'z' '''' no Set footer to x y z
.hx - no Suppress headers and footers on next page.
.he 'x'y'z' '''' no Set header to x y z
.hl - yes Draw a horizontal line
.i x no no Italicize x; if x missing, italic text follows.
.ip x y no yes Start indented paragraph, with hanging tag x. Indentation is y ens (default 5).
.lp yes yes Start left-blocked paragraph.
.np 1 yes Start numbered paragraph.
.of 'x'y'z' '''' no Set odd footer to x y z
.oh 'x'y'z' '''' no Set odd header to x y z
.pd - yes Print delayed text.
.pp no yes Begin paragraph. First line indented.
.r yes no Roman text follows.
.re - no Reset tabs to default values.
.sh n x - yes Section head follows, font automatically bold. n is level of section, x is title of section.
.sk no no Leave the next page blank. Only one page is remembered ahead.
.sm x - no Set x in a smaller pointsize.
.sz +n 10p no Augment the point size by n points.
.tp no yes Begin title page.
.u x - no Underline argument (even in troff). (Nofill only).
.uh - yes Like .sh but unnumbered.
.xp x - no Print index x.
3rd Berkeley Distribution 31 December 2010 GROFF_ME(7)