How can I modify my script to include or substitute missing data?
Let me start off by saying I am a self taught sometimes scripter so what you will see below won't be pretty.
I have created a script to parse through a file with a large amount of data and simply pull out what I need. In doing this I create several files and then paste them together in order to create a .txt file that can be imported into Excel for formatting. When I created the script (with a lot of help from the members of this forum) I "pounded" out some stats that were not required. I now need to pull the stats (the ones that are "pounded" out) but the first issue is there are several times that the true result of the stat is 0 and part of the original input file has erronious data that shows as a 0 so as you can see the script removes any report of a 0 as the result. The second issue is when the 0 is removed the file made for that certain "peg count" doesn't match line for line with the other pegcounts and it scews the data.
This first bit of code (this is only one 15 minute report, the actual file has 96 15 minute reports to encompass the entire days worth of data) is the file I am parsing, where you see the output of
that is the start of the eronious data and where you see the
is where the data starts to be correct.:
This bit of code is the script I use to do the parsing***Please note that for the purpose of this post I corrected the cgrep commands to include the correct amount of lines***: .
This bit of code is what I get if I run the file on a complete days worth of data, each column is associated with a "Peg Count" (p=12 - 21). Peg count 16 was all 0's so it is blank which I would like it to show 0. Peg count 17 had only 1 15 minute report with a 0 so it scews the data to look like I am missing the last report which I am actually missing a report from some time at the beginning of the file.
Now for the fun part, the erronious data that I mentioned at the begining isn't always there and I have NO idea when it will show. I hope I have explained this without confusing everyone.
Last edited by fsanchez; 06-18-2013 at 02:26 PM..
Reason: Needed to fix the script file
your issue may be with your data ... confirm what are in samp12c, samp12.txt, samp12a, samp12b.txt and samp12.txt as soon as you get the erroneous data and then also check the file containing the raw data for anything that seems out of place ...
your issue may be with your data ... confirm what are in samp12c, samp12.txt, samp12a, samp12b.txt and samp12.txt as soon as you get the erroneous data and then also check the file containing the raw data for anything that seems out of place ...
My apologies!!! I just realized there was an error in the version of the script file that I posted. I have edited the script file code to be correct now.
i have make file which i try to make them generic
but it keeps to compline it missing include directory
this is the makefile :
CXX=g++
CPPFAGS= -Wall -O0 -g -std=c++14
INCLUDES = -I/home/vagrant/libuv/include -Isrc
LIBS_DIRS = -L/home/vagrant/libuv/build
LDFLAGS=... (7 Replies)
Hi Experts,
I have a problem where I want to print missing columns (3,4) within a block of text. Each block is separated by "###". Some rows have missing column 3 and 4 which should be same as the previous value in column 3 and 4. The file is space delimited.
For example:
INPUT
###... (5 Replies)
HI Guys,
Input :- P081 wr1 12p0d5: 22.8
P081 wr1 12p2d18: 23.1
P149 wr1 1pxcud6/port_0_dev_7: 20.4
P149 wr1 1pxcud4/port_1_dev_10: 22.4
OutputP081 wr1 120 22.8
P081 wr1 122 23.1
P149 wr1 10 20.4
P149 wr1 11 22.4
In in First two line delete p and after d untill :
In Last two line... (4 Replies)
Dear All members,
i have some trouble here, i want to ask your help. The case is:
I have some data, it's like:
-ABCD1234
-ABCD1235
-ABCD1237
-BCDE1111
-BCDE1112
-BCDE1114
there is some missing data's sequence (the format is: ABCD = name 1234 = sequence).
I want to print the... (2 Replies)
I have the following script that greps lines containing "AT" from data files data1.hsq through data1000.hsq, then cuts their second column and puts in data files called perm1 through perm1000.
I want to modify the script so that instead of putting the data in separate data files perm1 through... (2 Replies)
Hello,
I have huge xml files and I need to replace only part of the data within a particular xml tag. This doesnt seem to be as simple as it sounds. I have searched everywhere and couldnt find any solution.
Ex:
In the below case I would like "def" to be replaced by "xyz" only when found in... (8 Replies)
using awk to substitute data in a column delimited text file
hello i would like to use awk to do the following calculation from the following snippet.
input file
C;2390 ;CV BOUILLOTTE 2L 2FACES NERVUREES ;1.00 ;3552612239004;13417 ;25 ;50 ; 12;50000 ; ; ... (3 Replies)
I need to read data from a file called "test.csv" through shell script where the file contains values like name,price,descriptor etc. There are rows where descriptor (& in some rows name) are written as string & other characters like "car_+" OR "bike*" etc where it should contains strings like... (3 Replies)
Hi All,
Here is what I'm trying to do with sed:
Input File:
somechangeVariable1=Something I would like to change
somechangeVariable2=Something else I would like to change
...
Output File:
somechangeVariable1=Something I would like to different
somechangeVariable2=Something else I would... (6 Replies)
Hi Experts,
The content of the raw file:
date,nomsgsent,nomsgnotdeliver,nomsgdelay
201003251000,1000,1,2
201003251000,900,0,0
201003251000,1450,0,0
201003251000,1230,0,0
However, sometimes, the column will missing in the raw files:
e.g.
date,nomsgsent,nomsgdelay... (8 Replies)