10-01-2013
Rudi,
Thanks, thats exactly what I'm looking for!
-Nick
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I wonder if any body can help me with a command i am struggling with. I have a file with around 400 lines in, in a program i have it pulls out each line at a time so that data from the line can be cross referenced with another file. If it finds a match it pulls out a ocde from the second file, this... (5 Replies)
Discussion started by: mariner
5 Replies
2. Shell Programming and Scripting
Hi.
I have an interesting problem and i couldn't find out the solution.
I have two variables in which there are a lot of lines finished by \n. I would like to concatenate this two variables into one in this format:
var1var2
var1var2
.
.
.
I could do this simply by command paste but it works... (32 Replies)
Discussion started by: samos
32 Replies
3. UNIX for Dummies Questions & Answers
input1
15 150
input2
x 10 100
input3
y 20 200
z 34 44
cmd
paste -d "\t" input1 input2 input3 >>output
output (1 Reply)
Discussion started by: repinementer
1 Replies
4. UNIX for Dummies Questions & Answers
I have a file which contains 3 fields separated by tabs example
andrew kid baker
I need to swap kid and baker using cut and paste commands how is this to be done?
Thanks (1 Reply)
Discussion started by: drew211
1 Replies
5. Shell Programming and Scripting
Recently i made a script for a project at molecular dynamics but am stuck at the last step.The thing i want to do is to ask the user to input the number of particles, then replace the bolded numbers at lines 9 and 17..
code
#!/bin/bash
#read number of particles
echo "insert the number of... (2 Replies)
Discussion started by: arisinhell
2 Replies
6. Shell Programming and Scripting
Hello. I've made a simple script which asks the user to input a hash and then runs a command that replaces the variable $hash with what the user inserted. The ting is that when the programm asks for input I can't paste anything there..! any clues?? :wall: (8 Replies)
Discussion started by: louboulos
8 Replies
7. Shell Programming and Scripting
Dear all,
I have two files like this
file1
A B
C D
E F
file2
1,2
3,4
5,6
I want this output
output_expected
A B 1,2
C D 3,4
E F 5,6 (3 Replies)
Discussion started by: valente
3 Replies
8. Shell Programming and Scripting
there are lot of files where in mostly all the file contains 2columnsAl,1
Ail,13
Al,3
Al,1
Al,3
Al,2
Al,3
Al,1
Al,1
Al,1
My requirement is i wanted only the second column of every file as a column ony in the base file... I used paste command... but it is not helping as I'm using while... (7 Replies)
Discussion started by: nikhil jain
7 Replies
9. Shell Programming and Scripting
Hello, I have a script extracting columns of useful numbers from a data file, and manipulating the numbers with awk commands. I have problems with my script...
1. There are two lines assigning numbers to $BaseForAveraging. If I use the commented line (the first one) and let the second one... (9 Replies)
Discussion started by: vgbraymond
9 Replies
10. Shell Programming and Scripting
Hi,
I am facing issue with paste command. It is adding spaces or tab in between.
I have say 3 files with below data
File_1
TH
THI
THIS I
File_2
IS IS
S IS RE
S
File_3
RECORD 1
CORD 2
IS RECORD 3 (3 Replies)
Discussion started by: Simanto
3 Replies
LEARN ABOUT OPENDARWIN
paste
PASTE(1) BSD General Commands Manual PASTE(1)
NAME
paste -- merge corresponding or subsequent lines of files
SYNOPSIS
paste [-s] [-d list] file ...
DESCRIPTION
The paste utility concatenates the corresponding lines of the given input files, replacing all but the last file's newline characters with a
single tab character, and writes the resulting lines to standard output. If end-of-file is reached on an input file while other input files
still contain data, the file is treated as if it were an endless source of empty lines.
The options are as follows:
-d list Use one or more of the provided characters to replace the newline characters instead of the default tab. The characters in list
are used circularly, i.e., when list is exhausted the first character from list is reused. This continues until a line from the
last input file (in default operation) or the last line in each file (using the -s option) is displayed, at which time paste
begins selecting characters from the beginning of list again.
The following special characters can also be used in list:
newline character
tab character
\ backslash character
Empty string (not a null character).
Any other character preceded by a backslash is equivalent to the character itself.
-s Concatenate all of the lines of each separate input file in command line order. The newline character of every line except the
last line in each input file is replaced with the tab character, unless otherwise specified by the -d option.
If '-' is specified for one or more of the input files, the standard input is used; standard input is read one line at a time, circularly,
for each instance of '-'.
EXAMPLES
List the files in the current directory in three columns:
ls | paste - - -
Combine pairs of lines from a file into single lines:
paste -s -d '
' myfile
Number the lines in a file, similar to nl(1):
sed = myfile | paste -s -d '
' - -
Create a colon-separated list of directories named bin, suitable for use in the PATH environment variable:
find / -name bin -type d | paste -s -d : -
DIAGNOSTICS
The paste utility exits 0 on success, and >0 if an error occurs.
SEE ALSO
cut(1), lam(1)
STANDARDS
The paste utility is expected to be IEEE Std 1003.2 (``POSIX.2'') compatible.
HISTORY
A paste command appeared in Version 32V AT&T UNIX.
BUGS
Multibyte character delimiters cannot be specified with the -d option.
BSD
September 20, 2001 BSD