Programming :: Merge Multiple Line With Semicolon Separated
Mar 29, 2010I have a script generating some containing multiple lines. But I want to merge all lines using comma separated.
View 6 RepliesI have a script generating some containing multiple lines. But I want to merge all lines using comma separated.
View 6 RepliesI have some data ( seperated by semicolon ) with close to 240 rows in a text file temp1. temp2.txt stores 204 rows of data ( seperated by semicolon ). I want to : Sort the data in both files by field1.i.e first data field in every row. compare the data in both files and print out the rows that are not equal in seperate files. I was trying to do this with excel using vlookup, without a great deal of success. hence, i'm exploring the shell script option.
Code:
temp1.txt
1000xyz400100xyzA00680xyz0;19722.83;19565.7;157.13;11;2.74;11.00
1000xyz400100xyzA00682xyz0;7210.68;4111.53;3099.15;216.95;1.21;216.94
1000xyz430200xyzA00651xyz0;146.70;0.00;0.00;0.00;0.00;0.00
[code]....
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.
Any hints why I'm getting the following message: dhclient: Internet Systems Consortium DHCP Client 4.1.1-P1 dhclient: Copyright 2004-2010 Internet Systems Consortium. dhclient: All rights reserved.
[Code]...
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
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.
got a situation where if i process a command i get a numeric output something like below:
for example:
# cat example.txt
856589
856470
987866
656658
876897
now i want to see this output in single line like below:
856589 856470 987866 656658 876897
how do i get this?
Here is my problem: I have a Vala program that includes classes with nested classes. When I try to initialize classes (using the variable type and the variable, followed by the class's arguments [three unsigned 8-bit integers] in parentheses) and try to compile the Vala code to C code what I tried to AVOID doing, as I really wanted to create a shared object file, but now I know I have to use C code as a middleman, the compiler tells me it expects a semicolon between the class variable name and its members.
What?! A semicolon in a bad place, that's for sure! Why would I want to put a semicolon *BETWEEN* the class initialization and its members? Isn't the whole point of a class to *HAVE* different members? Here is my class:
Code:
public class Gtk.rgba : GLib.Object {
public class fg_color : GLib.Object {
private uint8 red;
private uint8 green;
private uint8 blue;
//Constructor
public fg_color(uint8 r, uint8 g, uint8 b) {
[Code].....
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]...
Dear expertsI have files like
ABD : 5869 events, relative ratio : 1.173800E-01 , sum of ratios : 1.173800E-01
VBD : 12147 events, relative ratio : 2.429400E-01 , sum of ratios : 3.603200E-01
SDF : 17000 events, relative ratio : 3.400000E-01 , sum of ratios : 7.003200E-01
[code]....
I want to merge columns (selectively) from several files and create a new file with the merge output. I saw some suggestions to use pr/paste to join the columns and then awk to pick-up the columns.
Code:
pr -m -t -s file1 file2 | gawk '{print $4,$5,$6,$1}'
But I have hundreds of files and I cannot manually pick up columns using awk as given in
[code]....
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]...
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]....
how I can merge the data from file1(data per line) to the end of line of file2. So what I mean is, I want to add every line from file1 to the end of the corresponding line of file2.
View 2 Replies View RelatedI have a file which looks something like this:
##########
some
text
text also includes empty lines
##########
some
more
text
##########
Basically all sections are separated by 10 hashes and I need to somehow only print all lines in the last section (the "some more text" part in the example above"). I tried all kind of things with sed and awk but I didn't find any way to identify the last "section".
I am in the process of learning some scripting, however I am running into a roadblock in specifying a certain time format in the array. Ideally I would like to use Here are the lines of text that I am interrogating:
1123,3/25/2010,00:14 Thu,33229
1124,3/26/2010,13:30 Fri,33230
1125,3/27/2010,04:49 Sat,33231
[code]...
I am using ffmpeg for merge wav files to a mov video. My doing is below
1. First extract audio (wav file) from video
2. Create wav file from mp3 track 1
3. Create wav file from mp3 track 2
4 Merge extract audio from video with track 1 and track2.
Now finally create a new video with original video's video stream and merged audio stream.
Process is working. However final video is 3-4 times greater than original one. I want that final video should be near about size of original video. As I understand, all three wav files (created from ) make video larger.
Example commands i using is as below:
I have two files, file1.traj and file2.traj. Both these files contain identical data and the data are arranged in same format in them. The first line of both files is a comment.
At line 7843 of both files there is a cartesian coordinate X, Y and Z ( three digits ). And at line 15685 there is another three digits. The number of lines in between two cartesian coordinates are 7841. And there are few hundreds of thousands of lines in a file.
What I need to do is copy the X Y Z coordinate (three digits) from file1.traj at line 7843 and paste into file2.traj at the same line number as in file1.traj. The next line will be 15685 from file1.traj and replace at line 15685 at file2.traj. And I dont want other lines (data) in file2.traj get altered. This sequence shall be going on until the end of the file. Means copy and substitude the selected lines from file1.traj into file2.traj.
I tried to use paste command but I cant do for specified line alone.
Here i showed the data format in the file. I used the line number for clarity purpose.
Code:
Please I want Know the code of the Merge Sort with threads in C
View 7 Replies View RelatedI had a data structure like this:
I sort the list like this:
I think the logic is correct, maybe just some details.
Now my question is
1) Can I simply merge node1 and 2 without sorting? Like node_list1.merge(node_list2);
2) If not, how can I copy list1 and 2 into list3?
What is the best way to merge lines, in sed, awk or perl, that occur between certain strings? I'm new to sed scripting and I have been working on this for some time now. I have a large file (sample below) that I need to edit.
What I need looks something like this.
I'm working with a very large file so simply merging all the lines then adding a new line character before ">contig" and after "translated" won't work, at least not with sed.
I want to access a file, and check the length of every line.After, i want to check and replace all lines with length over 10 characters, with a message.Does anyone have a clue on that?
View 1 Replies View RelatedI have 2 very long files which are quite similar:
file1.csv:
Code:
file2.csv:
Code:
I need this output:
Code:
explanation:
If the fields 3 (serie) and 4 (modello) are identical, the lines of the 2 files should be "added":
Code:
If the fields 3 (serie) and 4 (modello) are different, just print the line of both files:
Code:
Is there a way to do this without reading the (huge) files with a "while read line" loop?
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:
I want to insert a line at a particular line number using sed or awk. where line number is not fixed and is in form of variable.
I want to use variable in sed or awk command.I tried something like below, but no luck.
Im trying to dual boot a samsung n130 netbook with the latest ubuntu distro being installed form a usb stick. The pc boots from the usb absolutely fine however all i get is a ";" at the top right corner. Any button presses make the usb light blink for a few seconds and place another ";".
I have tried the make usb from the iso and also the live usb application from [URL]
I have a project due for my Intro to C++ class and we are suppose to generate a file listing that will take an input of a C++ source code with .cpp extension and make a copy of it with a .lst extention that will have a line number preceding each and every line.
View 12 Replies View RelatedHow can I set indent in .emacs to enable my new line starts from the same position of previous line?
like this;
Hello world <enter>
Second Hello world // "S" starts right under first line's "H"
I wish to add information to one of my files based on matching IDs,
Here is an example
(the id is the 3 colunm)
(the ID is the 2 colunm)
And the output i wish to be
OUTPUT:
So as you can see the ones that do not match are still present, and the ones that do match just have the extra information from file2.txt added to them.
I thought about using join but that only seems to join the ones that match displays thoes only. i would like all the information in the output file.
At the moment I have a flat file which is being used by a few people. I want a script to remotely change the file, so I can start logging who is doing what.At this point here is one requirement I am trying to develop. We have text blocks who pretty much look like.I hope this is somewhat clear. I try to find $param for the right $workflow and change that. Can you help me to find $$var3 and change that?
View 1 Replies View Related