General :: Merge 2 Files With AWK By The Field Value
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
ADVERTISEMENT
May 18, 2010
I've had a very colorful morning learning the innerparts of Linux's sort command, and have come across yet another issue that I can't seem to find an answer for in the documentation. I'm currently using -t, to indicate that my fields are split by the comma character, but I'm finding that in some of my files, the comma is used (between double-quotes) within values:
Jonathan Sampson,,foo@bar.com,0987654321
"Foobar CEO,","CEO,",ceo@foobar.com,,
How can I use a comma to terminate my fields, but ignore the occurences of it within values? Is this fairly simple, or do I need to re-export all of my data using a more-foreign field-terminator? (Unfortunately, I do not have any control over declaring a different terminator with this particular project).
View 2 Replies
View Related
Sep 1, 2010
I have one file placed at one server whose sample as follows:
57272 28
56767 0
57575 4
[code]...
View 13 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
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
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
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
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
Mar 28, 2010
I'm trying to display fields from flat files where the first 8 fields are always the same. Fields 9 - n are varied but will contain specific patterns I'm after. I'm using this so far because "mySearch" is on each line I want to examine.
Code:
How would you pattern match and include 2 additional fields above field $9 but change field position from line to line?
View 12 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
Jan 8, 2010
How can print the, let's say 5nd field to the last field of every record (let's say we have 10 fields)?
I mean: I cant avoid to have to do:
print '{$5 $6 $7 $8 $9 $10}'
View 2 Replies
View Related
Apr 27, 2009
I am creating a game with random variables. In the game I have created a dialogue exchange to players. I have set up a table with various returns and I inserted {$fields} to represent various random variables. When I call on the requested fields, I only see the field text and my field names. Am I supposed to parse something and call it back another way?
ie: myfield is: "You have won {$random1} silver! <br />{$wi['gender'] majesty rewards you well." the code I am using to call that field is:
View 11 Replies
View Related
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
Dec 14, 2010
i have a file : file.dat with following data
Code:
STORAGE PERCENTAGE FLAG:
/storage_01 64% 0
/storage_02 17% 1
/storage_03 10% 0
/storage_04 50% 1
I need to get the value of PERCENTAGE in a variable for a value of storage passed as variable i have tried the following without success like :
Code:
percentage='awk -vx="$defaultStorage" '{FS=OFS=" "}$1==x{print $2}1' file.dat
View 2 Replies
View Related
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
Apr 4, 2010
The input file consists of several fields. The first field is always five or more characters long. I want to keep the last five characters of the first field.
Example:
If the input file record is FEDERAL PACIFIC ELECTRIC PRODUCTS then I want to keep DERAL I can do this in four steps by using C, REV, C, and REV again but that seems like doing an easy thing the hard way. Is there a straightforward way to achieve this result with C or some other command?
View 14 Replies
View Related
Mar 1, 2011
I am using a cluster of machines running on Ubuntu 10.04 LTS which are supposed to be homogeneous, but apparently they are not. In particular, I am configuring the X server on these machines.The problem is that the BusID of the graphic card is PCI:5:0:0 for some machines, and PCI:3:0:0 for others. Is there a way that the X server automatically detects the appropriate Device (based on the name for instance)?
View 1 Replies
View Related
Apr 24, 2010
I have a file containing text. I want to replicate a specific field.For example, I might want to append a copy of the second word of each line to the end of that line.Have: Once upon a midnight dreary, while I pondered weak and weary,Over many a quaint and curious volume of forgotten lore, Want: Once upon a midnight dreary, while I pondered weak and weary, upon Over many a quaint and curious volume of forgotten lore, many Is there a Linux command which will do this? I seek a basic command, not awk, not Perl, because I haven't learned those things yet.
View 14 Replies
View Related
Sep 27, 2010
I would like to know the command to change or add GECOS field of existing user. when i tried to find the command i end up getting this which is only valid for new user account.
Code:
useradd --help
-c, --comment COMMENT set the GECOS field for the new user account
My system details.
Code:
# lsb_release -a
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: OracleVMserver
Description: Oracle VM server release 2.2.0
Release: 2.2.0
Codename: n/a
View 1 Replies
View Related
Sep 1, 2010
In my file there are 2 fields separated by space.Sample content of file are as follows:56060 154242 053030 0Now i want to check second field of the file and if all values in second field are 0(zero) and send mail containing all contents of the file
View 3 Replies
View Related