General :: How To Concatenate Rows Of 2 Files
Apr 3, 2011How can i concatenate rows of 2 files.
File1:
File2:
How want file3 to be like?
How can i concatenate rows of 2 files.
File1:
File2:
How want file3 to be like?
I have an assignment question that I have been making no progress on.
I need a single line command to concatenate a group of files together and clearly label those files in the output.
I assume that just cramming a bunch of commands onto one line will not be considered OK.
and it has to work on some old version of Solaris (which I have been having trouble with normal commands not working the same all day on), but if you just have solutions for any normal Linux shell at least I would have an idea of what I am looking for.
I have looked though cat's man page up and down and I am pretty sure it cannot do what I want, and cannot seem to find any other commands that even concatenate a grouping of files together.
Have got a film broken up into 10 minute chunks a la ...... Tried cat file1.flv file2.flv > file1&2.flv but mplayer stopped, saying 'end of file', half way through playing file1&2.flv.
Is there some way to join them together into one, so the film may be played all the way through.
Just occurred to me you could use an * for the counting numeral in the filename e.g. mplayer file*.flv for file1.flv, file2.flv, etc..
I am trying to concatenate two files with a carriage return.
Iam not sure how we can implement this using .sh script.
For ex:
I tried concatenating using:
I got an output like:
Does anyone have a solution for merging files if the number of rows in the two (or more) files is non-equivalent.To exemplify, how about merging the following 3 files:
file1:
1
2
[code]...
I need to write shell script which can take number of files and count total rows from all CSVs and display total number of rows counted in all files. Is there any possibility of doing that using shell script and if yes then how.
View 4 Replies View RelatedI am supposed to take some small files, and print them to a specific printer, such that the small files are concatenated into one file. The file name has to be included in the file that gets printed.
Should I be looking to concatenate the files into one file with the file names included, and then print them?
something like: -printfunction -printername < file*
I searched a bit, but got overwhelmed by what I got.
I have a number of mpg files which I would like to concatenate to each other so I get one big file. I know how to do this with the cat command code...
I have a problem - I have files with rows of data and I need to check if the next row (of the same type) has the NEXT date in it so I need to extract a date in YYYYMMDD format from a row (easy enough) then add one day to it and compare it to the the next date I encounter on a subsequent row.
So if I have
DATE|20100530
VAL|kahskjhd
[code]...
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]...
I want to concatenate info from different lines from iptables.for exmaple, in my firewall using iptables I have this information.
pkts bytes target prot opt in out source destination
0 ACCEPT all -- * * 192.168.1.3 0.0.0.0/0
5 248 ACCEPT all -- * * 0.0.0.0/0 192.168.1.3
[code]...
I'm trying to concatenate two command in one line.
Below are the commands:
Code:
I wanted to list all files in /portal/apll/nad/send and grep only .tmp files that contains credit card word.
I have question regarding concatenation of two variables with underscore.i.e. (bourne shell)
Code:
# var1=123
# var2=456
[code]...
In my script, and I would like to concatenate 2 variables names, to give me the true variable.I've 3 variables X1, X2 and X3, and I invoked them inside a for loop.
Code:
#!/bin/bash
X1=HELLO
[code]....
How do I concatenate two environment variables in bash?
View 3 Replies View RelatedEvery once in a while on a computer I'm ssh'd into, I will accidentally type "cat largefile.txt" and my screen will start rushing with text for the next 10 minutes. I'm always working in a screen session, so my current solution is to just log out and then log back in, and since it can go 100X faster when I'm logged out, it'll finish in the short time it takes me to type my password in again. Is there a better way? Either involving the fact I'm in a screen session? Or a way to do this within SSH? What doesn't work: detaching from the screen session (doesn't respond until file is done outputting) trying command to move to a different window in the screen session (also doesn't respond) typing ctrl+C to kill cat command (also doesn't respond, probably because the command is done and the buffers just have to catch up).
View 3 Replies View RelatedI would like to transform rows into columns from a file in bash.
View 4 Replies View RelatedWhen Debian 6 (amd 64, testing) is loaded, before desktop appears, for a while, the screen is black and three strange green rows appear. Then, all is ok and I can see a normale desktop and start to use Debian. So, an error in video config could be possible. Linked to this fact (I think) , there is the impossibility to modify the resolution screen (that is fixed to 1024x768) and the refresh frequency. I've tried to find "xorg.conf" in order to modify it like various guides suggest me, but this file is not present.
View 1 Replies View RelatedI have a lot of files with thousands of rows and usually two columns of data. Column 1 is a coordinate, column 2 is a score. I want to delete rows that have a value in column 2 over, in this case, 50.
For example, here's a clip from a file:
2999898 39
2999899 40.9
2999900 42.7
2999901 44.7
2999902 46.7
2999903 48.9
2999904 51.1
2999905 53.3
2999906 55.7
I want the output to be this:
2999904 51.1
2999905 53.3
2999906 55.7
I know how to use sed for very basic things like deleting rows or ranges of rows but I can't figure out this ostensibly easy command.
I have a csv file that has around 3 million rows. I want to process this file so that it creates a new file that contains only the rows that have 2 characters or less in the first column column.At the moment i am using SQL Loader but its taking too long so im wondering whether this would be easier if done in Unix?
View 8 Replies View RelatedIs the maximum number of letters a database table column can contain 255?and is it a bad idea to build a table with about 15 columns?
View 1 Replies View RelatedI need to transpose a file with over a 1000 rows of 5 columns of numbers into a file with a single column of numbers. The numbers are separated by a single space and range from one digit to 5 digits each. I tried using awk, but can only get it to grab one column of numbers.
Input:
1 2 3 4 50
600 7 8 9000 10
11 12000 13 14 15
Desired output:
1
2
3
4
[code]....
Tried using: awk '{split($0,a,""); print $NF}' <filename> and got:
50
10
15
It only grabbed the last number in each row.
I have a big file full of records like this
1, 2, 4, 5, 6
1, 3, 5, 6, 3
1, 4, 5, 6, 6
2, 4, 5, 5, 5
2, 3, 4, 5, 2
anyway i need to take the average of all rows with the same 1st number(key). i.e.
1, 3, 4.66, 5.66, 5
2, 3.5, 4.5, 5, 3.5
I know this is something awk/sed would be great for, i just dont have enough experience with them to accomplish it, Also, what about averaging those columns together? so, after I output this to a file, id like to get another like:
1, 4.58
1, 4.125
The number of colums to add might not always be 4 either. EDIT: this might be easier to do in gnuplot, so I mainly just need an answer to the first part.
i am trying to get a script that i'm calling to have information from a sql populate into rows... but i'm not getting the data to output correctly into the rows. can someone please help?
<table>
<thead>
<tr>
<th>Name</th>
<th>Help</th>
<th>Folder</th>
code....
I'm not that familiar with sed and awk in order to be able to solve this problem on my own, so I'm calling on you for a bit of assistance. I'm writing a Nagios plugin to check our Oracle tablespaces and the output is given in one line like this: 1.04007771 TEMP 0 UNDOTBS1 .005340579 USERS 0 7 rows selected. I've been playing around with sed like below to delete the obsolete info and change every second space into a newline:
[code]...
how many tablespaces there are so I'd have to check all databases and 'hardcode' the tablespaces in my script. Is there any way to 'automate' this knowing that 'rows selected' preceded by a number is always the last line and using a sort of counter to auto-adjust the number to put in the -e 's/ / /2' part?
if there's a tab-delimited file under /usr/desktop, how can I determine the number of rows and columns of the file in shell?And, if told the the 3rd column of the file contains only numerical values and all values in the 5th column are unique, how can I verify these in shell?
View 13 Replies View RelatedI know that ImageMagick's convert program can be used as follows to convert a collection of images -- say, in PNG format -- to a PDF file:
convert *png output.pdf
The problem with this is that each image is then stretched to fit on one page, whereas I would like to keep the original dimensions of the images and put as many as possible on one page in the PDF file before moving on to another page.
i have text file that filename contain the date of creation (i.e 2010.05.02.log).I would like to create a script that:-Ask for start date -Ask for end date- Concatenate all file on the requested period by date order.
View 1 Replies View RelatedI would like to create csv output from an ipcalc calculation.
Code:
[me@host scripts]$ ./ipcalc 192.168.30.40/255.255.255.248
Address: 192.168.30.40 11000000.10101000.00011110.00101 000
[code]....
I cannot get this to work
Code:
#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
import re
# @description "This is a describing text about the file currently documentet";
#DocC documentation prototype
[Code]...