Sponsored Content
Full Discussion: Create csv from text file
Top Forums Shell Programming and Scripting Create csv from text file Post 302991287 by jiam912 on Wednesday 8th of February 2017 01:59:23 PM
Old 02-08-2017
Create csv from text file

Gents,

I am trying to create a csv file using the file attached.

I have a problem to get all information required because the rows are not continues.

Here is my code till now.

Code:
awk '    /"ffid"/{if(s){print s;s=$NF}else{s=$NF}}
    /"LineNumber"/{s=s $NF}
    /"PointNumber"/{s=s $NF}
    /"x"/{s=s $NF}
    /"y"/{s=s $NF}
    /"z"/{s=s $NF}
    /"date"/{s=s $NF}
    /"Valid"/{s=s $NF}
    /"AcquisitionLength"/{s=s $NF}
    /"AcquisitionNumber"/{s=s $NF}
    /"FileDate"/{s=s $NF}
    /"FileSize"/{s=s $NF}
    /"GPSTimeOfAcquisition"/{s=s $NF}
    /"JulianDay"/{s=s $NF}
    /"NumberOfAuxes"/{s=s $NF}
    /"NumberOfDeadSeisTraces"/{s=s $NF}
    /"NumberOfLiveSeisTraces"/{s=s $NF}
    /"NumberOfSeisTraces"/{s=s $NF}
    /"RecordLength"/{s=s $NF}
    /"SampleRate"/{s=s $NF}
    /"SourceEasting"/{s=s $NF}
    /"SourceNorthing"/{s=s $NF}
    /"SourceLineNumber"/{s=s $NF}
    /"SourcePointNumber"/{s=s $NF}
    /"SwathName"/{s=s $NF}
    /"TapeNumber"/{s=s $NF}
    /"SweepLength"/{s=s $NF}
    /"TestRecordType"/{s=s $NF}
    /"TotalNumberOfTraces"/{s=s $NF}
    /"TypeOfSource"/{s=s $NF}
    /"PointIndex"/{s=s $NF}
    END{print s}' input | sed -e 's/"//g' > tmp1

Kindly can you help me to get the output desire (.csv attached)

Thanks a lot
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Merging files to create CSV file

Hi, I have different files of the same type, as: Time: 100 snr: 88 perf: 10 other: 222 Each of these files are created periodically. What I need to do is to merge all of them into one but having the following form: (2 Replies)
Discussion started by: Ravendark
2 Replies

2. Shell Programming and Scripting

Command to create and update csv file

Hi, I need to create a csv file to store oracle query output. This report need to be created on hourly basis. The csv file report format as "Report_22_Sep_09_13IST.csv". I have the oracle query. Now i need to create and move the oracle query output to the report row by row starting from 3rd row.... (6 Replies)
Discussion started by: Sekar1
6 Replies

3. Shell Programming and Scripting

how to create csv file using shell script

I have a file in multiple directory which has some records in the following format File: a/latest.txt , b/latest.txt, c/latest.txt -> Name=Jhon Age=27 Gender=M Street=LA Road Occupation=Service I want to generate a csv file from the above file as follows File: output.csv -> ... (9 Replies)
Discussion started by: rjk2504
9 Replies

4. Shell Programming and Scripting

How can I create a CSV file from PL/Sql in UNIX?

Can someone help me on creating a script that will manage/create a csv file from Pl/Sql using UNIX?Any advice is welcome,thank you so much,:) (2 Replies)
Discussion started by: Atrap
2 Replies

5. Shell Programming and Scripting

Create an .csv/excel file using shellscript

In my file, i have 4 Product names(For ex:Microsoft excel, Oracle,.Net,IBM websphere,..etc.,) I want this 4 Products in 4 individual .csv/excel file after running the script with those products related information. (12 Replies)
Discussion started by: Navya
12 Replies

6. UNIX for Dummies Questions & Answers

How to create a .csv file from 2 different .txt files?

Hi, I need to create a .csv file from information that i have in two different tab delimited .txt file. I just want to select some of the columns of each .txt file and paste them into a .cvs file. My files look like: File 1 transcript_id Seq. Description Seq. Length ... (2 Replies)
Discussion started by: alisrpp
2 Replies

7. Shell Programming and Scripting

Script to create a CSV file

I created a script that will go out and so a "/sbin/chkconfig --list | egrep XXX" against a server list that would create an output file like the following example: ---------------------------------------------------------------------------------- SERVER1 RC_Script_1 0:off 1:off 2:off... (4 Replies)
Discussion started by: asnatlas
4 Replies

8. Shell Programming and Scripting

Need help. How to create csv file?

Hi I'm a beginner and I have some problem. I have multiple files in the same directory which has one column but rows following the format. File: directory/Disk.txt Content: a b c d e File: directory/Memory.txt a b c d e File: directory/CPU.txt (3 Replies)
Discussion started by: thenuie
3 Replies

9. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

10. Shell Programming and Scripting

Process text file to create CSV

I am working on a text file where I have to get data from a text file and convert it into either CSV format or Column format as shown below. OUTPUT Expected GRP Name Pair Size DName DNumber PName PNumber adm_grp Pair1 150.00KG Pair_0ABC_1 0396 Pair_0267_s 1292 ... (6 Replies)
Discussion started by: shunya
6 Replies
py_xls2csv(1)						      General Commands Manual						     py_xls2csv(1)

NAME
py_xls2csv - convert an Excel xls file to a comma separated value csv file SYNOPSIS
py_xls2csv input-file DESCRIPTION
This manual page was written for the Debian distribution because the original program does not have a manual page. py_xls2csv takes an Excel xls file as an argument and converts it to a comma separated value csv file. Output is sent to stdout. Additional utility scripts can be found in the tools/ directory. OPTIONS
This program does not take any command line options. AUTHOR
pyexcelerator and py_xls2csv were written by Roman V. Kiseliov <roman@kiseliov.ru>. This manual page was written by Kevin Coyner <kcoyner@debian.org> for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. SEE-ALSO pyexcelerator(1), py_xls2txt(1), py_xls2html(1) October 12, 2006 py_xls2csv(1)
All times are GMT -4. The time now is 06:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy