10 More Discussions You Might Find Interesting
1. 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
2. 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
3. Shell Programming and Scripting
How can I accomplish this? I basically want to merge two variables onto the same line. I can do it with two FILES this way:
$ cat /tmp/users_in.list | awk -F "," '{print $2}' | cut -c -1 > first.initial
$ awk -F "," '{print $1}' /tmp/users_in.list | awk '{print $1}' > last.name
$ paste... (5 Replies)
Discussion started by: greenlightening
5 Replies
4. 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
5. 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
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
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
8. 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
9. 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
10. 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
paste(1) User Commands paste(1)
NAME
paste - merge corresponding or subsequent lines of files
SYNOPSIS
paste [-s] [-d list] file...
DESCRIPTION
The paste utility will concatenate the corresponding lines of the given input files, and write the resulting lines to standard output.
The default operation of paste will concatenate the corresponding lines of the input files. The NEWLINE character of every line except the
line from the last input file will be replaced with a TAB character.
If an EOF (end-of-file) condition is detected on one or more input files, but not all input files, paste will behave as though empty lines
were read from the files on which EOF was detected, unless the -s option is specified.
OPTIONS
The following options are supported:
-d list Unless a backslash character () appears in list, each character in list is an element specifying a delimiter character. If a
backslash character appears in list, the backslash character and one or more characters following it are an element specifying a
delimiter character as described below. These elements specify one or more delimiters to use, instead of the default TAB charac-
ter, to replace the NEWLINE character of the input lines. The elements in list are used circularly. That is, when the list is
exhausted, the first element from the list is reused.
When the -s option is specified:
o The last newline character in a file will not be modified.
o The delimiter will be reset to the first element of list after each file operand is processed.
When the option is not specified:
o The NEWLINE characters in the file specified by the last file will not be modified.
o The delimiter will be reset to the first element of list each time a line is processed from each file.
If a backslash character appears in list, it and the character following it will be used to represent the following delimiter
characters:
Newline character.
Tab character.
\ Backslash character.
Empty string (not a null character). If is immediately followed by the character x, the character X, or any character
defined by the LC_CTYPE digit keyword, the results are unspecified.
If any other characters follow the backslash, the results are unspecified.
-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 will be replaced with the TAB character, unless otherwise specified by the -d option.
OPERANDS
The following operand is supported:
file A path name of an input file. If - is specified for one or more of the files, the standard input will be used. The standard input
will be read one line at a time, circularly, for each instance of -. Implementations support pasting of at least 12 file operands.
USAGE
See largefile(5) for the description of the behavior of paste when encountering files greater than or equal to 2 Gbyte ( 2**31 bytes).
EXAMPLES
Example 1: Listing a directory in one column
example% ls | paste -d" " -
Example 2: Listing a directory in four columns
example% ls | paste - - - -
Example 3: Combining pairs of lines from a file into single lines
example% paste -s -d" t n" file
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of paste: LANG, LC_ALL, LC_CTYPE, LC_MES-
SAGES, and NLSPATH.
EXIT STATUS
The following exit values are returned:
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWesu |
+-----------------------------+-----------------------------+
|CSI |Enabled |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
SEE ALSO
cut(1), grep(1), pr(1), attributes(5), environ(5), largefile(5), standards(5)
DIAGNOSTICS
"line too long" Output lines are restricted to 511 characters.
"too many files" Except for -s option, no more than 12 input files may be specified.
"no delimiters" The -d option was specified with an empty list.
"cannot open file" The specified file cannot be opened.
SunOS 5.10 20 Dec 1996 paste(1)