Visit The New, Modern Unix Linux Community


Missing data


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Missing data
# 1  
Missing data

Gents,

Using the following code.

Code:
awk -F: 'BEGIN {
print "Time,FFID,Swath,Line,Point";
}
/(SCI TB Timestamp Local : |File # :|Swath Name :|Tape # :|Line Name :|Point Number :|Type_Of_Dump|Type_Of_Test|Tape_Nb|Tape_Label|Date|Hist)/{
sub("^[ \t]*","",$2);sub("[ \t]*$","",$2); if($1 ~ /Hist/) { printf "%s\n", $2; } else { printf "%s,", $2; }
} ' File_1.txt

File_1.txt ( attached )
I got this output

Code:
Time,FFID,Swath,Line,Point
11/28/15 3,21,2975,7733,41711.0,49169.0,N/A
11/28/15 3,22,2975,7733,41701.0,47993.0,N/A
11/28/15 3,23,2975,7733,41279.0,48881.0,N/A

Please how i can get the following output
Code:
11/28/15 3:07:16.273 PM,21,2975,7733,41711.0,49169.0,N/A
11/28/15 3:07:17.921 PM,22,2975,7733,41701.0,47993.0,N/A
11/28/15 3:07:21.773 PM,23,2975,7733,41279.0,48881.0,N/A

Thanks for your help Smilie
# 2  
Hello jiam912,

Could you please try following and let me know if this helps.
Code:
awk -F" : " 'BEGIN{print "Time,FFID,Swath,Line,Point"} /SCI TB Timestamp Local/{A=$NF} /File #/{A=A?A OFS $NF:$NF} /Swath Name/{A=A?A OFS $NF:$NF} /Tape #/{A=A?A OFS $NF:$NF} /Point Number/{A=A?A OFS $NF:$NF} /Line Name/{A=A?A OFS $NF:$NF;} /Type of Test/{A=A? A OFS $NF:$NF;print A;A=""}' OFS=,   Input_file

Output will be as follows.
Code:
Time,FFID,Swath,Line,Point
11/28/15 3:07:16.273 PM,21,2975,7733,41711.0,49169.0,N/A
11/28/15 3:07:17.921 PM,22,2975,7733,41701.0,47993.0,N/A
11/28/15 3:07:21.773 PM,23,2975,7733,41279.0,48881.0,N/A

Thanks,
R. Singh
This User Gave Thanks to RavinderSingh13 For This Post:
# 3  
R. Singh
Works many thanks
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #655
Difficulty: Medium
In the mid-1980s Microsoft developed a multitasking version of DOS.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filling in the missing data point by awk

I am learning AWK by trying out examples whenever I need a specific conversion. I would like to edit the 'before.txt' so that all the missing data points between 140-150 are added and shown as 0. before.txt 145 2 148 13 149 17 to below, 140 0 141 0 142 0 143 0 144 0 145 2 146 0... (5 Replies)
Discussion started by: numareica
5 Replies

2. Programming

Find gaps in time data and replace missing time value and column 2 value by interpolation in awk

Dear all, I am kindly seeking assistance on the following issue. I am working with data that is sampled every 0.05 hours (that is 3 minutes intervals) here is a sample data from the file 5.00000 15.5030 5.05000 15.6680 5.10000 16.0100 5.15000 16.3450 5.20000 16.7120 5.25000... (4 Replies)
Discussion started by: malandisa
4 Replies

3. UNIX for Dummies Questions & Answers

Delete data blocks based on missing combinations

Hello masters, I am filtering data based on completeness. A (Name , Group) combination in File2 is only complete when it has data for all subgroups specified in File1. All incomplete (Name , Group) combinations do not appear in the output. So for example , Name1 Group 1 in File2 is... (6 Replies)
Discussion started by: senhia83
6 Replies

4. SuSE

How to resolve missing missing dependencies with opensuse 11.3 and 12.3?

Hello, This is a programming question as well as a suse question, so let me know if you think I should post this in programming. I have an application that I compiled under opensuse 12.2 using g77-3.3/g++3.3. The program compiles and runs just fine. I gave the application to a colleague who... (2 Replies)
Discussion started by: LMHmedchem
2 Replies

5. Shell Programming and Scripting

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... (2 Replies)
Discussion started by: fsanchez
2 Replies

6. UNIX for Advanced & Expert Users

Checking missing data's sequence (shell script | UNIX command)

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)
Discussion started by: septian.tri
2 Replies

7. Shell Programming and Scripting

Fill in missing Data

hello everyone, I have a task to input missing data into a file. example of my data below: Wed Feb 01 09:00:02 EST 2012,,,0.4,0.3,,0.3,,0.3,,0.5,,0.3,,,0.4,0.3, Wed Feb 01 09:00:11 EST 2012,,,,,,,0.2,,,,,,,,,, Wed Feb 01 09:00:22 EST... (23 Replies)
Discussion started by: Nolph
23 Replies

8. Shell Programming and Scripting

extract data and display the missing value

Hi, I have thousands of data in 1 file that need to be sorted out. My file is like below:- File1.txt condition 1 scaf_27 CDS 48317 48517 "e_gww2.27.12.1" Id 35277 scaf_27 stop_cod 48317 48319 "e_gww2.27.12.1" scaf_27 CDS 48518 49107 "e_gww2.27.12.1" ... (4 Replies)
Discussion started by: redse171
4 Replies

9. UNIX for Dummies Questions & Answers

Missing the 'data' archive in my PC

Hello everyoane I folow step by step (i' new in unix) this video tutorial YouTube - rogriff's Channel to instal unix in a personal laptop, but when he go in C -> data -> downloads -> resume020807 in mi pc not exist I attach the filles to see, thank you in advance (3 Replies)
Discussion started by: ___
3 Replies

10. UNIX for Advanced & Expert Users

missing data in FTP file

Hello - I am FTPing file from remote unix box to my unix box. I am FTPing file around 2AM. some time, the complete fle is not ftping.. I am missing data in the FTP file. It happens few times in a month. Whenever, i miss the data, the file size is always 60106. The actual file size is not that... (4 Replies)
Discussion started by: govindts
4 Replies

Featured Tech Videos