Sponsored Content
Full Discussion: Text parsing
Top Forums Shell Programming and Scripting Text parsing Post 302912030 by Akshay Hegde on Tuesday 5th of August 2014 09:46:05 AM
Old 08-05-2014
Code:
akshay@nio:/tmp$ cat file
@1 line:Any text aaa
@2 line:tag1, tag2
@3 line:Any text bbb
@1 line:Any text ccc
@2 line:tag3, tag4
@3 line:Any text ddd

Code:
akshay@nio:/tmp$ awk '{print ( /@2 line/ ) ? $1":"sprintf(fmt,$2,$2) OFS sprintf(fmt,$3,$3) : $0}' FS='[:, ]' OFS=',' fmt='<XO>%s<XC,"%s","","","",0,0,"">' file

Code:
@1 line:Any text aaa
@2:<XO>line<XC,"line","","","",0,0,"">,<XO>tag1<XC,"tag1","","","",0,0,"">
@3 line:Any text bbb
@1 line:Any text ccc
@2:<XO>line<XC,"line","","","",0,0,"">,<XO>tag3<XC,"tag3","","","",0,0,"">
@3 line:Any text ddd

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Text parsing question

How would I split a file based on the location of a string, basically I want all entries above the string unix in this example 1 2 3 4 unix 5 6 7 Thanks, Chuck (3 Replies)
Discussion started by: 98_1LE
3 Replies

2. Shell Programming and Scripting

Text File Parsing

Hey Guys.I am a newbie on Bash Shell Scripting and Perl.And I have a question about file parsing. I have a log file which contains reports about a communication device.I need to take some of the reports from the log file.Its hard to explain the issue.but shortly I can say that, the reports has a... (2 Replies)
Discussion started by: Djlethal
2 Replies

3. Shell Programming and Scripting

Parsing text from file

Any ideas? 1)loop through text file 2)extract everything between SOL and EOL 3)output files, for example: 123.txt and 124.txt for the file below So far I have: sed -n "/SOL/,/EOL/{p;/EOL/q;}" file Here is an example of my text file. SOL-123.go something goes here something goes... (0 Replies)
Discussion started by: ndnkyd
0 Replies

4. Shell Programming and Scripting

Parsing text

Hello all, I have some text formatted as follows Name: John doe Company: Address 1: 7 times the headache Address 2: City: my city State/Province: confusion Zip/Postalcode: 12345 and I'm trying to figure out how I could extract the data after the colon so that the result would be ... (6 Replies)
Discussion started by: mcgrailm
6 Replies

5. Shell Programming and Scripting

Need help parsing a text file

I have a text file: router1#sh ip blah blah | incl --- Gi2/8 10.60.4.181 --- 10.60.123.175 11 0000 0000 355K Gi2/8 10.60.83.28 --- 224.10.10.26 11 F9FF 3840 154K Gi2/8 10.60.83.198 --- ... (1 Reply)
Discussion started by: streetfighter2
1 Replies

6. Shell Programming and Scripting

Help with text/number parsing

Hello I have a file that contains 10 rows as below: "ID" "DP" "ID=GRMZM2G015073_T01" "23.6044288292005" "ID=GRMZM2G119852_T01" "59.7782287606723" "ID=GRMZM2G100242_T02" "61.4167813736184" "ID=GRMZM2G046274_T01" "6.63061838134219" "ID=GRMZM2G046274_T02" ... (5 Replies)
Discussion started by: cs_novice
5 Replies

7. Programming

Parsing a Text file using C++

I was trying to parse the text file, which will looks like this ###XYZABC#### ############ int = 4 char = 1 float = 1 . . ############ like this my text file will contains lots of entries and I need to store these entries in the map eg. map.first = int and map.second = 4 same way I... (5 Replies)
Discussion started by: agupta2
5 Replies

8. Shell Programming and Scripting

Parsing text file

I'm totally stumped with how to handle this huge text file I'm trying to deal with. I really need some help! Here is what is looks like: ab1ba67c331a3d731396322fad8dd71a3b627f89359827697645c806091c40b9 0.2 812a3c3684310045f1cb3157bf5eebc4379804e98c82b56f3944564e7bf5dab5 0.6 0.6... (3 Replies)
Discussion started by: comp8765
3 Replies

9. Shell Programming and Scripting

Parsing text file

Hi Friends, I am back for the second round today - :D My input text file is this way Home friends friendship meter Tools Mirrors Downloads My Data About Us Help My own results BLAT Search Results ACTIONS QUERY SCORE START END QSIZE IDENTITY CHRO STRAND ... (7 Replies)
Discussion started by: jacobs.smith
7 Replies

10. Shell Programming and Scripting

Parsing blocked text

I do have a flat text file that are divided into blocks. Each block is demimited by '='. I would like to parse certain numbers and letters. This is the format of the file I have. It has thousands of such blocks >A B 1, 100 TTTT 100 95 >C D 1, 95 GHJKL = >A B 1, 72 GHUJKLO 72 84 >C D... (3 Replies)
Discussion started by: Kanja
3 Replies
PLPTEX3(3plplot)						    PLplot API							  PLPTEX3(3plplot)

NAME
plptex3 - Write text inside the viewport of a 3D plot. SYNOPSIS
plptex3(x, y, z, dx, dy, dz, sx, sy, sz, just, text) DESCRIPTION
Writes text at a specified position and inclination and with a specified shear within the viewport. Text is clipped at the viewport bound- aries. The reference point of a string lies along a line passing through the string at half the height of a capital letter. The position of the reference point along this line is determined by just, and the reference point is placed at world coordinates (x, y, z) within the viewport. The inclination and shear of the string is specified in terms of differences of world coordinates making it easy to write text parallel to a line in a graph. Redacted form: plptex3(x, y, z, dx, dy, dz, sx, sy, sz, just, text) This function is used in example 28. ARGUMENTS
x (PLFLT, input) x coordinate of reference point of string. y (PLFLT, input) y coordinate of reference point of string. z (PLFLT, input) z coordinate of reference point of string. dx (PLFLT, input) Together with dy and dz, this specifies the inclination of the string. The baseline of the string is parallel to a line joining (x, y, z) to (x+dx, y+dy, z+dz). dy (PLFLT, input) Together with dx and dz, this specifies the inclination of the string. dz (PLFLT, input) Together with dx and dy, this specifies the inclination of the string. sx (PLFLT, input) Together with sy and sz, this specifies the shear of the string. The string is sheared so that the characters are vertically par- allel to a line joining (x, y, z) to (x+sx, y+sy, z+sz). If sx = sy = sz = 0.) then the text is not sheared. sy (PLFLT, input) Together with sx and sz, this specifies shear of the string. sz (PLFLT, input) Together with sx and sy, this specifies shear of the string. just (PLFLT, input) Specifies the position of the string relative to its reference point. If just=0., the reference point is at the left and if just=1., it is at the right of the string. Other values of just give intermediate justifications. text (const char *, input) The string to be written out. AUTHORS
Geoffrey Furnish and Maurice LeBrun wrote and maintain PLplot. This man page was automatically generated from the DocBook source of the PLplot documentation, maintained by Alan W. Irwin and Rafael Laboissiere. SEE ALSO
PLplot documentation at http://plplot.sourceforge.net/resources. August, 2012 PLPTEX3(3plplot)
All times are GMT -4. The time now is 09:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy