General :: Merge File1 At End Of Line File2?

Mar 23, 2010

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


ADVERTISEMENT

Programming :: Copy And Replacing Specific Line From File1 To File2 Line By Line

Mar 22, 2011

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:

View 10 Replies View Related

Programming :: Using File1 As List Of Objects To Search For In File2?

Aug 30, 2010

The goal is to auto-update a webpage that contains links to network devices. These devices are all set to DHCP, and their hostnames are not guaranteed to stay the same, so static IPs or accessing via hostname is NOT an option.

Process: Run a script every hour or so to query devices on the local network to generate a list of responding devices by MAC address and what their current IP is (results.lst). Using a "static" MAC address list file "printers.db" as the database search "results.lst" to find specific MAC addresses. When a match is found, grab the IP from "results.lst" and update "index.html" with the new IP address. No comparison needs to be done between "results.lst" IP and "index.html" IP as I just want to overwrite whatever is there.

Here is what I have so far (using dummy data): PRINTERS.DBProduct Mac Address Printer1 00:00:00:00:00:11 Printer2 00:00:00:00:11:11 Printer3 00:00:00:11:11:11 Printer4 00:00:11:11:11:11 Printer5 00:11:11:11:11:11 Printer6 11:11:11:11:11:11 TEST.SH

Code:

#!/bin/sh
#------------------------------
# Quick Links Updater v2.0 |
# By Rob M. |
# with help from Tim F. |
#------------------------------

[code]....

View 4 Replies View Related

Programming :: Shell Script - Appending File1 To End Of File2

Jun 21, 2010

I'm working on some code where I have two files. I know I can use cat file1 >> file2 to append file1 to the end of file2. What I was wondering is how I could append the first line of file 1 to the end of the first line of file2, then the second line, and so forth.

So if file1 was :
cat
dog
mouse

file2:
orange
red
blue

I want file2 to be:
orange cat
red dog
blue mouse

Also I need it to remove any duplicates from the same horizontal line.

View 5 Replies View Related

Programming :: Bash And Can't Find How To Say "if File1 Exists And File2 Exits Then..."

Aug 17, 2010

I'm learning Bash and can't find how to say "if file1 exists and file2 exits then...".I thought this may work:

Code:
file1="/root/file1"
file2="/root/file2"

[code]....

View 5 Replies View Related

Programming :: Scripting: Using "File1" As List Of Objects To Search For In "File2"

Aug 30, 2010

The goal is to auto-update a webpage that contains links to network devices. These devices are all set to DHCP, and their hostnames are not guaranteed to stay the same, so static IPs or accessing via hostname is NOT an option.

Process: Run a script every hour or so to query devices on the local network to generate a list of responding devices by MAC address and what their current IP is (results.lst). Using a "static" MAC address list file "printers.db" as the database search "results.lst" to find specific MAC addresses. When a match is found, grab the IP from "results.lst" and update "index.html" with the new IP address. No comparison needs to be done between "results.lst" IP and "index.html" IP as I just want to overwrite whatever is there.

Here is what I have so far (using dummy data):
PRINTERS.DBProduct Mac Address
Printer1 00:00:00:00:00:11
Printer2 00:00:00:00:11:11
Printer3 00:00:00:11:11:11
Printer4 00:00:11:11:11:11
Printer5 00:11:11:11:11:11
Printer6 11:11:11:11:11:11
[Code]....

View 10 Replies View Related

Programming :: Adding Line From File1 Into A Line Of Another File Based On Maching IDs

Jan 3, 2011

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.

View 6 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 :: 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

Ubuntu Multimedia :: Ffmpeg Audio Merge With Video Merge

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

General :: Replace File1.tgz With Another Version Of The Same File?

May 30, 2010

i got the slackware folder with my builds of my favorites packages, in /tmp i create the new versions of that packages. theres is a way in bash to replace the new ones in /tmp with the old ones in /home/user/slackware??

something like..... in /tmp: mv -i package1.tgz /home/user/slackware | and somethin to replace the old version of the app with the new one

View 8 Replies View Related

General :: Comparing Files - Change The Case Of The Letters In File1.txt

Nov 8, 2009

Two files contain:

file1:
cat
dog
fish
hamster

file2:
cat
fish
ferret
dog

How do you change the case of the letters in file1.txt to uppercase and compare with file2 all in one command?

View 2 Replies View Related

General :: Join/merge Many Mp3 Files?

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

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 View Related

Ubuntu :: Restore A File After A >file1?

Jun 30, 2010

a collegue has done this for a shell script > test1.sh .lolnow i must rewrite the script.do you have any idea to find my script?

View 2 Replies View Related

General :: Merge LVM Partition With Unallocated Space?

May 25, 2010

I have a linux hard drive with three areas:

/dev/hda1 - ext3 boot partition (20 MB)
/dev/hda2 - lvm2 main partition (6 GB)
unpartitioned space - 12 GB

I would like to merge the unpartitioned space into the lvm2 partition known as /dev/hda2. I tried using GParted, but it does not support lvm2. What commands or utilities could I use to add the unpartitioned space to hda2 without losing my existing data?

View 3 Replies View Related

General :: How To Merge EXT4 With Unallocated Partition

Jul 20, 2011

I'm installing Windows to update my BIOS. I've removed a previous partition but I can't merge free partition to my original partition containing data. How to solve this problem? I don't want to format the ext4 partition.

View 1 Replies View Related

General :: Create A RAID Set Up And Merge Partitions?

Aug 7, 2009

I have three hard drives in my computer That I want to make RAID 0. All of them already have partitions and data on them. What I want to know is if I can, without losing data, add the disks to RAID and then merge the partitions? All the partitions are of the same type. Or would it easier/better/possible to do this with LVM? Even if I'd have to shrink partitions and copy data to a new LVM one to get it set up properly, would it be better than RAID 0?

View 2 Replies View Related

General :: Merge 2 Partitions Say /dev/hda8 And /dev/hda9?

May 4, 2011

Is that possible to merge the 2 ext3 partitions without moving data in the old partitions? What i did was, i created new partition say /dev/hda8, which is to be merged to some old partition say /dev/hda3.

View 3 Replies View Related

General :: How To Merge Two Partitions And Disable KTTSD

Feb 19, 2010

how do i merge two partitions in my harddisk!!! i am using kubuntu 9.10 and also how do i disable KTTSD!!

View 3 Replies View Related

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 View Related

General :: Merge Pdf Files Vertically AND Horizontally?

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

General :: Combine / Merge Left And Right Video Files?

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

General :: Merge Files By Creation / Modification Date?

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

General :: Merge Lists With Common Heads/tails?

Sep 5, 2010

My question is probably better explained by example; I have two files that look like this:

Code:
$ cat file1.txt
mercury
venus
earth
mars

[Code]....

The general stipulations are as you'd expect; both files are of an arbitrary length, generally file1 will be larger than file2 but this is not guaranteed, the common lines (if any) will always be contiguous and only occur at the end of file1 and the start of file2.

View 14 Replies View Related

General :: Merge Four 230GB SATA Hard Drives On An Already Running Fedora 9 OS?

Dec 18, 2010

I recently finished installing Fedora 9 on a Prolient ML 330 G6 Server, but i configured the SATA hard drives to be viewed as four seperate hard drives. I was asked to merge the drives to be seen as one 800GB hard drive, my biggest fear is that we had set up Samba to share folders between fedora 9 giving specific users access to specific files saved on the Prolient server, will those settings be lost.And could you call that a File Server or do you have to enter any more settings And also if anyone could point me to a tutorial on Logical Volume Management and Raid specifically for fedora 9

View 10 Replies View Related

Ubuntu Networking :: Cifs: Setting Times Of `file1': Operation Not Permitted?

Mar 14, 2010

I have a WD MyBook World NAS share mounted with the following options (I tried also other options):Code:cifs nouser,atime,auto,rw,nodev,noexec,nosuid,nodfs,nounix,guest,uid=0,gid=0,file_mode=0777,dir_mode=0777The cp -a, touch, etc. commands can change the file time if the root is executing the command (means NAS supports time setting), but as an user I can't change the file time - with an exception of changing the time to the current time. For an illustration see below:

Code:
.../tmp> ls -la
total 0

[code]....

View 2 Replies View Related

General :: Create Cron Tab When DSL Line Down Set Automatically Restart The Network Service While DSL Line Up?

Oct 7, 2010

How to create cron tab when DSL line down set automatically restart the network service while DSL line up?

View 3 Replies View Related

General :: Getting The Line Of String From Previous Pipe Output By Line Number?

Feb 8, 2010

After running the following command, I get:

[root@yukiko /]# find / -iname .bashrc
/home/clamav/.bashrc
/home/vpopmail/.bashrc
/etc/skel/.bashrc
/root/.bashrc

But I would like to have a command that prints a specific line by supplying the command with the line number, for example:

[root@yukiko /]# find / -iname .bashrc | getline(2)
/home/vpopmail/.bashrc

Is there such a command on CentOS?

View 3 Replies View Related

General :: Script To Count # Of Chars Per Line - If Line Meets Certain Criteria - And Get Avg #?

Sep 11, 2009

I have several files with many lines something like this:

I'm trying to write a script that will count the number of characters per line that doesn't contain a ">" symbol and give me an average of those values. I have most of the script together but I can't figure out how to connect some of the steps.

Code:

View 3 Replies View Related







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