General :: Merge Columns From Multiple Files?
Dec 20, 2010
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]....
View 14 Replies
ADVERTISEMENT
Apr 13, 2011
I 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?
View 14 Replies
View Related
Sep 22, 2010
I'd like to extract a single column from 5 different files and put them gether in an output file. I saw a similar question for 2 input files, and the line of code workd very well, the code is:awk 'NR==FNR{a[NR]=$2; next} {print a[FNR], $2}' file1 file2I added the file3, file4 and file5 at the end, but it doesn't work. Does anyone know what do I have to do?
View 5 Replies
View Related
May 26, 2011
I've been hitting my head against a wall for awhile with this one:As the last part of some data analysis I performing I would to construct a matrix from a series of different files. These files have the format:
file 1 file 2 file 3
AAAAA .1 AAAAA .1 BBBBB .1
BBBBB .2 BBBBB .1 CCCCC .9
[code]...
View 6 Replies
View Related
Aug 18, 2010
I am having a souce file (say SOURCEFILE) as below with 5 columns and many rows.
pol name status loan address
123 aaa 21 100 RJY
234 bbb 31 200 RMY
345 ccc 21 300 SJY
456 ddd 41 400 pqr
i want to compare the file (say COMPAREFILE ) which is below :
123
345
I need the following output file (sayOUTPUTFILE) as below :
( ie for file COMPAREFILE i need column 2, column 4 ie name and loan from source file )
ie output file required is to be like below :
123 aaa 100
345 ccc 400
Till now iam using the following method.
1. cutting column 2nd column
2. again cutting 4th column
3. in third, step merging the 2nd and 4 th column.
method of writting single line command or any awk programme to do this in one step.
I need output file (say OUTPUTFILE) as below
View 1 Replies
View Related
Jul 27, 2011
I've searched everywhere and I can't come up with a good solution. For each line I need to find the average, min, and max. I've seen plenty of solutions where the number of columns is fixed, unfortunately for me these lines can get pretty large. My thought was to read each line individually into an array, loop through the array and find the avg, min, and max that way but i haven't had much luck. I can read each line using a while loop but I'm having trouble with the array part, or perhaps that's not the best solution?
View 14 Replies
View Related
Oct 10, 2010
I have three files with the following structure:
file1
1 2 3 4
5 6 7 8
[code]...
View 4 Replies
View Related
Jul 23, 2011
Searching Google on how to join/merge many mp3 files, it suggests that I should just cat them together.That might "work", but clearly it is not the correct way to do it, as each header and set of IDv3 tags will also be concatenated.Does a Linux program exist that can be scripted to join/merge many mp3?Can mplayer/mencoder/ffmpeg do it?
View 2 Replies
View Related
Jun 1, 2010
i have 2 file and want to merge them in the first one. the first file is like this:
2 word1
1 word2
6 word3
2 word4
......
the second:
word1 :file1 :file2
word2 :file6
word3 :file1 :file2 :file2 :..up to file6
word4 :file7 :file1
.......
So i want to ADD all those File fiels Wich have different FN for every record.
View 8 Replies
View Related
Apr 13, 2011
1. Is there an easy way to combine pdf files not only one "after" the other, but also one "next to" the other? For example, If I have one-page files called a1.pdf, a2.pdf, a3.pdf, a4.pdf, b1.pdf, b2.pdf, b3.pdf, b4.pdf, c1.pdf, c2.pdf, c3.pdf, c4.pdf, I want to combined them so that I can scroll down from a to c and scroll right from 1 to 4. That is, I want to merge them in "matrix form". If I zoom out the final file should look like:
a1 a2 a3 a4
b1 b2 b3 b4
c1 c2 c3 c4
(TWELVE pages in total)
Is this possible? I tried Google but found no information.
2. Also, is it possible to just put all of them together in a single page. If I zoom out the page should look like:
a1a2a3a4
b1b2b3b4
c1c2c3c4
(ONE page in total)
Note: I would like to do this for many one-page files
View 1 Replies
View Related
Dec 19, 2010
I was trying to do a school assignment in LaTeX. The assignment involves having the page split into three columns: the first column is for the quote, the second is for a reaction, and the third is for questions. These columns must be able to break in the middle of a row. I was trying to accomplish this using LaTeX.
First, I tried the longtable environment, but that would not allow me to pagebreak in the middle of a row. Then, I tried parcolumns, but for some reason, the second "row" had a huge space between the first two words. Does anyone know of an environment suitable for this kind of work?
View 4 Replies
View Related
Feb 23, 2010
I have a folder with only 24 files named <number>.dat (i.e. 4.dat, 6.dat and so on) where <number> is between 0 and 256. Each file has just two columns of data and nothing else.
I'm trying to combine all the second columns ($2) together. I've been fiddling around with getline and so far have
awk '{ getline ln < "6.dat" ; print ln" "$2 }' 4.dat
which takes file 4.dat and adds $2 from 6.dat, but I want a single command to take each $2 from every file and add them to (for example) 4.dat (having $1 from 4.dat is no problem). A command that takes every file in the folder and grabs $2 and places them in a common file would be ideal. Frankly I can work around if you combine both columns from every file.
View 5 Replies
View Related
Jan 11, 2011
How can I join the two parts of a stereoscopic movie to get a side-by-side one?
I can expand the left file, that way all I'll need is to paste the second one on top of it, with something like this:
mencoder left-file.mkv -o side-by-side.avi -oac copy -ovc lavc -of avi -vf scale=1280:720,expand=-1280:0:0:0 -sws 3 -lavcopts vbitrate=16000
Any idea which tool should I use on a Linux system?
View 1 Replies
View Related
Oct 4, 2010
I have a folder with hundreds of .txt files (logs of some java application) that I have to merge in to one single .txt file. This application produces a new log file everyday:
day1: logFriday10September2010.txt
day2: logSaturday11September2010.txt
...
day8: logFriday17September2010.txt
...
and so on...
I could merge the files easily with "cat" and ">>" however, the problem is that I have to do it by taking into account the date (creation or modification) of the file.
If I simple use the cat command the output file will receive for example, all Fridays in a row, then all Saturdays, etc. and in that way I'm not considering the date.
I've searched for the options of the find command, since the files after creation are not modified...I try to use this for example:
$ find . -newer <some old file>
but that lists me all files after that <old file> and not by correct date.
View 5 Replies
View Related
Nov 10, 2009
Each line of the file I am sorting is in the following format:
<url> <month> <day>
For example:
[URL]
I wrote the following to sort:
Code:
#!/usr/bin/perl
$in = shift;
chomp($in);
[code]....
The script worked fine for my small testing files, but failed in my input file. The input file is 18MB and containing more than 300,000 lines. The output will contains some lines like that:
url_one 10 1
url_two 10 1
url_three 10 3
url_four 10 1
Is that because my file is too big for perl to handle ?
View 10 Replies
View Related
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
Aug 23, 2010
I am to rename all the files within a directory (which contains multiple subdirectories) recursively without invalid characters.
I tried the coding posted above.
find . -type f -printf '%p
' | while read file; do
oldfile=$(basename "$file")
newfile=$(echo "$oldfile" | sed 's/[^A-Za-z0-9_.]/_/g')
if [ ! "$newfile" == "$oldfile" ]; then
echo mv "$file" "${file%$oldfile}$newfile"
code....
but I get an error on both of them stating "find: bad option -printf find: [-H | -L] path-list predicate-list"
View 9 Replies
View Related
Jun 17, 2010
I've been looking though different editors for one that has good printing support. Ideally it should be able to print C++ code with line numbers, syntax highlighting, multiple columns per page, customizable fonts and sizes and a print preview feature so that I can make sure it looks right before sending it to the printer. It appears that notepad++ had at least some of these features, but it is not available on linux. The best I could do so far is to copy/paste the output of 'cat -n foo.cpp' into oowriter and format it into two colums. I don't get synax highlighting though and I have to manually replace tabs with a few spaces as well as some excessive leading spaces before the line numbering.
View 1 Replies
View Related
Feb 22, 2011
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:
View 6 Replies
View Related
Feb 15, 2010
I have two files which I would like to combine. Each file has 2 columns.
File 1:
1 a
2 b
[code]...
View 2 Replies
View Related
Apr 14, 2010
I have a bunch of RTF files that I need to merge into just one RTF.
I'm sure there is an easy way to do this, but I just can't find out how
View 1 Replies
View Related
Jun 16, 2010
Iam aware of the way on how almost every file can be converted to .pdf within Ubuntu 10.04 using "Print to File" function. But is there a way to merge multiple files to create one .pdf? OR Is there a way to merge multiple .pdf files to create a single .pdf?
View 5 Replies
View Related
Jul 6, 2011
So I found PDftk which seems promising Im also looking at the commands which are also very powerful..but I think its kinda of laborious to type all my 50+ pdf files in the command prompt I have the front end of pdftk I was wondering is there a program (I have Pdf sam and Pdf Shuffler) that will allow me to import unlim. number of files and then just jam it into one big PDF file?
View 4 Replies
View Related
Nov 20, 2010
I have a movie split into 3 iso image files, say, movie-1.iso,movie-2.iso, and movie-3.iso I did the following:
[ewn]# cd /mnt
[mnt]# mkdir disk1 disk2 disk3
[mnt]# mount -t iso9660 -o ro,loop=/dev/loop0 /media/Hitachi_SATA_2TB/iso_files/Movies/movie-1.iso /mnt/disk1
[mnt]# mount -t iso9660 -o ro,loop=/dev/loop1 /media/Hitachi_SATA_2TB/iso_files/Movies/movie-2.iso /mnt/disk2
[Code]....
the files for disk2, disk3 are exactly the same except disk2 has 2 .vob files instead of 3. Can I make this work by changing the names of some of these files before merging them into one directory and then running the mkisofs command to create a new single iso image? If so, what names do I give so that the movie plays correctly? If not, just how do you do this?
View 8 Replies
View Related
Sep 18, 2010
I have several image files accumulated as a result of taking screenshots. I want to merge all of them into a single pdf file. How can I do that? I save webpages in .mht format using UnMHT addon in firefox. Is there any way to merge several mht files into a single pdf?
View 7 Replies
View Related
Jul 28, 2011
Is there any bash script to merge pdf files in a directory and sub-directory and rename it as the directory/sub-directory name?Like for example using GhostScript/PDFTK/PyPDF etc?I'm kinda new where it comes to bash scripting.I found this script on a blog that seems to do what I want, however, the bookmark functionality is not of importance to me (and requires jPDFBookmark - which I can't manage to install)
Code:
#!/bin/bash
#
[code]...
View 2 Replies
View Related
Jul 25, 2010
I am trying to install centos 5.5 via virtualbox. Is it necessary to merge these parts of the iso image before installing (say by virtualbox)?
View 2 Replies
View Related
Jan 18, 2010
this is not the right place to ask this question, but I found no other.I have an AAC audio file and a video file. Is there any way to merge them? I tried Avidemux but it won't let me open my AAC file.
View 2 Replies
View Related
Nov 27, 2010
I have to merge two different pdf files and I don't know how to do this. ..(I use opensuse 11.3 with gnome).
View 9 Replies
View Related
Mar 31, 2010
how can i merge two files with ffmpeg?
one is : /home/pt/t/pa1.flv
the other is : /home/pt/t/pa2.flv
1 o merge with ffmpeg
ffmpeg -i /home/pt/t/pa1.flv -i /home/pt/t/pa2.flv -vcodec copy -acodec copy /home/pt/t/dd.flv
the problem is: the merged file ( /home/pt/t/dd.flv ) just contain one file--the first one
/home/pt/t/pa1.flv,there is no the second file--/home/pt/t/pa2.flv in the /home/pt/t/dd.flv
[Code].....
View 4 Replies
View Related