I have got this working OK but I am sure there is a more efficient/elegant way of doing it, which I hope you can help me with.
It can be done in whatever is most suitable i.e perl/awk..
Any suggestions are welcome and many thanks in advance.
What I require is to extract the first field using " as the FS upto the last . in that field. Sometimes there are several . in that field.
The second field is from the last . to the first "
The third field is from the first " to the | removing spaces.
This output is only required if the third field using the " as FS is blank, and the second field upto the | has data present.
Below is an example of all variants of the data I have in a file 800000+ rows.
I have got this working OK but I am sure there is a more efficient/elegant way of doing it, which I hope you can help me with.
It can be done in whatever is most suitable i.e perl/awk..
You are calling awk 6,400,000+ times, and sed 800,000+ times.
With 800000+ rows, you need awk, but you only need one call to awk, not eight (including one that does nothing) and one to sed for every line of the file.
OK, the Awk script has a problem whereby it is providing an output from the test when there is no characters so I am presuming it is spaces/tabs.
Can you help with this?
With the perl script it works OK, apart from on a couple of lines it fails due to a line with the highlighted character. Have you any ideas and if you could put some comments regards this script I would appreciate it. My perl is not too good.
Hi Guys,
I am new to shell script.I need your help to write a shell script.
I need to write a shell script to extract data from a .csv file where columns are ',' separated.
The file has 5 columns having values say column 1,column 2.....column 5 as below along with their valuesm.... (1 Reply)
Hi folks
I have a script I wrote that basically parses a bunch of config and xml files works out were to add in the new content then spits out the data into a new file.
It all works - apart from the xml and config file format in the new file
with XML files the original XML (that ends up in... (2 Replies)
Hello,
I open a new POST, i consider that this is resolved
https://www.unix.com/shell-programming-scripting/215803-create-file-comment-script.html
But i wish improve it.
In case 1, I would like to test the input file $1.
If $1 exist with no parameters but only comments, then send a message... (2 Replies)
Experts ,
Below is the data:
--- Physical volumes ---
PV Name /dev/dsk/c1t2d0
VG Name /dev/vg00
PV Status available
Allocatable yes
VGDA 2
Cur LV 8
PE Size (Mbytes) 8
Total PE 4350
Free PE 2036
Allocated PE 2314
Stale PE 0
IO Timeout (Seconds) default
--- Physical volumes ---... (5 Replies)
I have a data file like below:
2011 0701 2015 21.2 L 37.692 46.202 18.0 Teh 4 0.3 2.1 LTeh 1
GAP=233 E
Iranian Seismological Center, Institute of Geophysics, University of Tehran 6
STAT SP IPHASW D HRMM SECON CODA AMPLIT PERI AZIMU VELO SNR AR TRES W DIS CAZ7
TBZ SN EPg 0 2015 31.19 -0.3... (3 Replies)
Hi,
I do have a data file which is divided into compartments by ---------. I would like to extract (parse) some of the data and numbers either using awk or sed
The file has the format:
CATGC
Best GO enrichment:
Genes/ORF that have the motifs (genes are sorted by max(pa+pd+po)):
... (6 Replies)
Hi friends,
I need to parse the following data in the given format and get the desired output. I need a function, which takes the input as a parameter and the desired output will be returned from the function.
INPUT(single parameter as complete string)
A;BCF;DFG;FD
... (3 Replies)
Input file:
HS04636 type header 836 7001 ID=g1
HS04636 type status 836 1017 Parent=g1.t1
HS04636 type location 966 1017 ID=g1.t1.cds;Parent=g1.t1
HS04636 type location 1818 1934 ID=g1.t1.cds;Parent=g1.t1
HS04636 type status 1818... (8 Replies)
Hi all , I have a file with billing CDR records in it. I need to parse that information (row format) . The purpose is to compare full content. The example I have given below is a single line record but it has two portions, (1) the line start with “!” and end with “1.2.1.8” and (2) second part... (5 Replies)
Hi I need to parse the following data using shell script
Table
-----
stage4n_abc 48
stage4o_abcd 4
adashpg_abc_HeartBeat 1
stage4l_asc 168
Can anyone gimme the solution.
I want each value to get stored in an array or variable and want the value to be greped from another file.... (1 Reply)