Programming :: Split Multi Line Record Into Multiple Files With Awk?

Nov 11, 2009

I have a large file 'NS0923.csv' with data like the following. There are two records in this multi-record sample.

Code:

E60898,4578910,03/06/09,BEN BOYD RD,61,82,,,127,3,,52000.3046.001,3155,4.00,,PLT,1356,1.00,05/06/09,Y,Y,0551
,,,,,,,,,,,,4057,1.00,CLEAN CAR SHARE SIGN,LAB,0551,1.00,,,,

[code]....

2. I still have to create a file 'transaction.csv' that should retrieve data from $13 - $15 with the identifying column $1. Required output:

Code:

E60898,4057,1.00,CLEAN CAR SHARE SIGN

3. And finally another file 'quantity.csv'. Retrieving data from $16 - $18 with identifier $1. Required output:

Code:

E60898,PLT,1356,1.00
E60898,LAB,0551,1.00
E60898,LAB,3065,1.00

[code]....

View 10 Replies


ADVERTISEMENT

Software :: Use Command Line To Split A Single-lined XML Into A Multi-line XML?

Dec 9, 2010

I have a many text files that have XML tags all shoved into 1 line. I want to create a new file that splits each XML tag onto a new line. code...

View 3 Replies View Related

Programming :: BASH: Each Line Of Multiple Text Files Gets Added To One Line?

Sep 12, 2010

I currently have 3 files with floating point data that I wish to have in a single file with the format:

Code:

F1 F1 F3 Output
a1 b1 c1 a1 b1 c1
a2 b2 c2 a2 b2 c2
a3 b3 c3 a3 b3 c3
a4 b4 c4 a4 b4 c4

View 3 Replies View Related

Programming :: Bash Reading Multiple Files Line By Line?

Mar 8, 2011

I have a set of files containing data that I need to re-arrange into one single property list.

The files that I have look like this:

Code:
# cat uk
<string>10</string>
<string>11</string>
...
<string>29</string>

[Code]....

So the lines in the files match up but I haven't found a way of reading several files line by line.

View 3 Replies View Related

General :: Split A File Into Multiple Files Using AWK?

Aug 5, 2010

I have a file with 5 columns. Column 4 contains numbers.Is it possible to split the file into multiple files using a condition for the contents of column 4 i.e if column 4 contains a value between 0-10 then print the lines to a new file called less_than_10.txt

View 1 Replies View Related

Ubuntu :: Command To Split A File Into Multiple Files?

Nov 22, 2010

I have a log file on ubuntu 10.04 that has 500 lines of log data in it. What command could I use in a terminal to split the single 500-line file into generate ten files each with 50-lines of log files each?

View 2 Replies View Related

Ubuntu Multimedia :: Split Wav Files From The Command Line?

Apr 2, 2011

how to split wav files from the command line?

View 4 Replies View Related

Programming :: Multi-line Find - Replace With GnuWin32 Sed?

Apr 26, 2009

I would like to have a script that will do a search in an XML file for a specific block of XML code and replace it with a different block of XML code using the Windows build of GNU Sed 4.1.5.

Here's the text I want to find:

Code:

And here's what I want to replace it with:

Code:

There is however a lot of stuff in there that would mess up sed, and the one example from the sed FAQ (from the Sourceforge site) that looked promising and easy enough to figure out (4.23.3. Try to use a block of "literal strings") fails with this error message: sed: file blockrep.sed line 18: unterminated `s' command

Anyone got any ideas, or even an alternate program that can do this? (Preferably one that I can automate.)

View 4 Replies View Related

Ubuntu Multimedia :: Record Flash Video Streaming Into Multiple Files?

Jul 12, 2010

I am trying to record streaming flash video to multiple files each limiting upto 10 mins.Thinking of two possible ways to script,1) saving the files with 10 minute time limit on the fly as I record2) record the whole video as single file and split into multiple files with time limit.

View 1 Replies View Related

Programming :: Compare Two Files Line By Line And Print The Line Which Is Same?

May 30, 2011

I am trying to write a program in C which compares two files and prints the line that is equal.

Here file1.txt has

and file2.txt has

Note: file2.txt consist of only a single string where as file2.txt has multiple lines. Actually im comparing two files with md5sum values.

Here is the code but it compares only first line of files..but it should compare the whole file1..and sorry iam a beginner in C can any1 sujest some modification to this code so that..it can compare file2 with entire file1

Quote:

View 9 Replies View Related

Ubuntu :: App For Multi Terminal With Split Capabilities?

Jun 13, 2010

I would like for X11 something like dvtm.

Could you post the possible package names that does that?

View 1 Replies View Related

Programming :: Split A File To Multiple File Using Awk Or Perl?

Feb 27, 2011

I have a single file that contain multi-text something likes this:

Quote:

No. Time Source Destination Protocol Info
185 27712.068199 192.168.18.23 192.168.18.191 SMTP S: 250 2.1.5 Ok
No. Time Source Destination Protocol Info
186 27715.068293 192.168.0.50 192.168.5.2 TCP suncacao-jmxmp > 44693 [ACK] Seq=1 Ack=1 Win=64807 Len=1380

[Code].....

View 14 Replies View Related

Programming :: Open Two Text Files - Read Them Line By Line And Update Parameters Of The 3rd File ?

Oct 18, 2010

I have two txt files containing x and y coordinates: xcoord.txt & ycoord.txt. I need to open them; read them line by line to get each coordinate; then each time I need to update Xs and Ys parameters inside another file called "dc.in" with the grabbed values.

Finally each time I need to run two exe files ( dc_2002 and st_vac) and produce corresponding output for each Xs and Ys ( dc.in is an input file for this exe files)

I have written the following code but it does not work:

View 14 Replies View Related

Programming :: Parse Files With Variable Record Length?

Aug 6, 2010

I would like to extract Room number, Lastname,Firstname,invoice (205880080),arrival date, departure date, and total(229.46). Can you at least give me a hint on how to proceed? I have tried a lot but I am stumped from the beginning.

***History***
Room: 124 B Payment: Bell/TRAVELSCAPE.COM
Lastname*FIT*,Firstname 4A, 0K, 0B Guest
Bell *205880080 FT
Bell *205880080 July 31, 2010

[Code]...

View 4 Replies View Related

Programming :: Keeping The Separate Files In Sync Line By Line?

May 5, 2010

I'm extracting data from a xml file writing it to separate files then combining the results as a csv file.The problem is keeping the separate files in sync line by line.When a grep does not action I would like to put in a blank line or something to keep the lines in order.When the "<title>" is missing as in as in the first"<programme </programme>" that's where I need somethingto write to the file as dummy data to increment the line

here's the data

Code:

<programme channel="15552.dvb.guide" start="20100504200000" stop="20100504204000">
<category>Show / Game Show</category>
</programme>
<programme channel="14498.dvb.guide" start="20100504200000" stop="20100504203000">

[code]....

View 14 Replies View Related

Programming :: Using Python To Merge Two Text Files Line For Line

Jul 6, 2010

I'm a bit new to Python programming and hoped that someone might be able to help with a problem I'm having. What I essentially want to do is to combine two text files line for line. I know how to do this in a bash script so to give you a better idea here's the code for that:

Code:

This is basically for adding on values to the end of a CSV file that uses ';' as the delimiter. So say file1 said:

And file2 said:

Then running this command would create merged_file1_and_file2 which would be:

The code I'm using at the moment is:

Code:

As I'm sure any experienced python programmer will see, this prints out the first line of the file "csvraw" and then all of the lines of "stamps" and then the remainder of "csvraw".

What I'd like to do is something like: (pseudo code, I know it's not python ;-))

Code:

Is this possible? I've tried googling and my Python Pocket Reference hasn't been much help. I've looked at pickling but that doesn't seem appropriate.

View 1 Replies View Related

Programming :: Awk Multiple Line Search And Replace?

May 1, 2011

I am trying to search and replace a multi line pattern in a php file using awk.The pattern starts with

<div id="navbar">
and ends with
</div>

[code]...

View 3 Replies View Related

Ubuntu :: Find Multiple Files In The Command Line?

Mar 2, 2010

command line, I have a server for work that I ssh into and I need to be able to find multiple files (they have the leading text just the date identifier changes) and then zip the files (with bzip) them and then finally scp(Secure copy) them to another server.

These files are always in the same directory and this is a daily task and just want to make into a script that I run once I am logged into the remote server.

View 4 Replies View Related

Ubuntu :: Move Multiple Files Via Command Line?

Sep 15, 2010

I liked the idea of the "cosmos" screensaver/desktop, but wanted to add my own pictures to the application. I navigated to /usr/share/backgrounds/cosmos and tried to drag and drop. I quickly found that I did not have permission to do this.

I googled my problem and found some command line tutorials telling me to sudo cp. My problem is that I have about 30 pics that I want to move in there, and I don't think I can just move the directory, they have to be in that folder as the pictures themselves.

I don't really feel like typing the cp line multiple times with multiple randomly named image files.

Is there a way to have the command line cp all of my files from one directory to another?

View 4 Replies View Related

General :: Search And Replace Line In Multiple Files?

Jul 13, 2010

Hello, I need some help searching through multiple files, finding a line and replacing that line. The line I am searching for is:

password key ******* 1222554

ultimately I want to be able to delete the numbers after the asterisks . my thoughts are to create a script that will search for the line password key ******* and delete it then replace it with password key ******* my files are located in /opt and they are all txt files.

View 13 Replies View Related

Programming :: Merge Multiple Line With Semicolon Separated

Mar 29, 2010

I have a script generating some containing multiple lines. But I want to merge all lines using comma separated.

View 6 Replies View Related

General :: Inserting Multiple Files To Mysql On Command Line?

Mar 5, 2011

I am using ubuntu and mysql.I have a list of many .sql files, like 1.sql, 2.sql, 3.sql ... 100000.sqlI need to insert them into the database mysql mydb < *.sqlGives me: -bash: *.sql: ambiguous redirect

View 2 Replies View Related

Programming :: Going Through A Multi-step Process To Produce Output Files, Which Involves 25,000 Greps At One Stage?

Nov 8, 2010

I am going through a multi-step process to produce output files, which involves 25,000 greps at one stage. While I do achieve the desired result I am wondering whether the process could be improved (sped up and/or decluttered).input 1set of dated files called ids<yyyy><mm> containing numeric id's, one per line, 280,000 lines in total:

Code:
123456
999996

[code]....

View 14 Replies View Related

Programming :: Multiple Line Pattern Matching And Variable Extraction?

Oct 19, 2010

I have this complex log file filled with entries like

test1-G1/0/0-100-QOS-7001923-ROUTING (ClassMap)
Action: Resolved New
sysName: test1.local

[code]...

View 1 Replies View Related

OpenSUSE :: Count Lines In Multiple Text Files From Command Line?

Apr 27, 2010

I want to (from the command line) be able to counte lines in a bunch of files of a specific type in a folder and all its sub-folders. How would I do this?

View 1 Replies View Related

Ubuntu :: Command Line - Find And Replace Text Within Multiple Files?

Aug 28, 2010

I'm pretty sure this is doable from the command line, but my CLI skills have degraded a lot since my pre-Y2K admin days. The goal is to search all the files in the directory for a very long string of text and replace it with another string of text. The text being searched for is my Google Adsense code (which will be stripped from my website) and it will be replaced with a placeholder so I can easily tack something else in there in the future.

Seeing how I have that long snip of code on about 100 pages, automating the process would make life easier.
If I was searching for a single word, I can see ways to do this.
If I paste the code I'm searching for into a text file, is there a way to:
find (contents of oldstring.txt) and replace with (contents of newstring.txt)?

View 9 Replies View Related

General :: VIM Command To Split A Line Into 2?

Apr 27, 2010

How can I split a line in vim into 2. example :

original line :

welcome to linux questions

after splitting :

welcome to
linux questions

Is there a single key strike through which i can do it ? like going to the word "to" and striking that key will put rest of the words in new line. ( i want to do it in normal mode , not in the usual insert mode where it obviously can be done by typing <Enter> )

View 6 Replies View Related

Ubuntu :: Split A Tar Archive Into Multiple Parts ?

Feb 11, 2010

Is there any way to split a tar archive into multiple parts?

View 1 Replies View Related

Ubuntu :: Split Multiple Images From One Image?

Mar 14, 2010

I have a couple of gigs of png files, each with 5-7 photos on each file. Currently I am making 5-7 duplicates of the file, then opening each one in gimp, and cropping and saving each one. kind of time consuming. Does anyone know of a program that will let me split an image into multiple slices?

View 5 Replies View Related

General :: Extract SampleID From Split Line?

Oct 12, 2010

I have a text file of n-number of tab-delimited lines ("INPUT") which I would like to parse line-by-line to a text output file depending on the SampleID of the line. These lines contain a unique SampleID and each subject has several lines of data.

[code]....

I also have a text file of relevant SampleID ("INPUT2"). The basic idea is that I read a line from INPUT, split the tab-delimited line, extract the SampleID from the split line, compare the SampleID of this line to my list of relevant SampleIDs. If there is a match, then print the line from INPUT to OUTPUT, then move on to the next line of INPUT. Alternatively, if there is no match, then move on to the next line in INPUT. I tried to script this (extreme newbie at perl right now) and failed miserably, but here is what I have at the moment:

[code]...

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved