Parse all of your required line to different file with awk and then join all of your file with the paste command. With the paste command you can use any kind of seperator also. In this example i used semicolon.
Hi,
I have one situation. I have some 6-7 no. of files in one directory & I have to extract all the lines which exist in all these files. means I need to extract all common lines from all these files & put them in a separate file.
Please help. I know it could be done with the help of... (11 Replies)
Hi! I have a large set of pairs of text files (each pair in their own subdirectory) and each pair shares head/tail (a couple of first and last lines) but differs in the middle part. I need to delete the heads/tails and keep only the middle portions in which they differ. The lengths of heads/tails... (1 Reply)
Hello guys,
I need a script to get the common lines from two files with a criteria that if the first two columns match then I keep the maximum value of the 3rd column.(tab separated columns)
Sample input:
file1:
111 222 0.1
333 444 0.5
555 666 0.4
file 2:
111 222 0.7
555 666... (5 Replies)
Hello guys,
I need a script to get the common lines from two files with a criteria that if the first two columns match then I keep the maximum value of the 5th column.(tab separated columns) . 3rd and 4th columns corresponds to the row which has highest value for the 5th column.
Sample... (2 Replies)
Hello everyone
A few years Ago the user radoulov posted a fancy solution for a problem, which was about finding common lines (gene variation names) between multiple samples (files). The code was:
awk 'END {
for (R in rec) {
n = split(rec, t, "/")
if (n > 1)
dup = dup ?... (5 Replies)
Dear All,
I have 2 files. If field 1, 2, 4 and 5 matches in both file1 and file2, I want to print the whole line of file1 and file2 one after another in my output file.
File1:
sc2/80 20 . A T 86 F=5;U=4
sc2/60 55 . G T ... (1 Reply)
Hi! I would like to comm -12 with one file and with all of the files in another folder that has a 100 files or more (that file is not in that folder) to find common text lines. I would like to have each case that they have common lines to be written to a different output file and the names of the... (6 Replies)
Could it be possible to find common lines between all of the files in one folder? Just like comm -12 . So all of the files two at a time. I would like all of the outcomes to be written to a different files, and the file names could be simply numbers - 1 , 2 , 3 etc. All of the file names contain... (19 Replies)
Hi,
A beginner one.
my input.tab (tab-separated):
h1 h2 h3 h4 h5
item1 grpA 2 3 customer1
item2 grpB 4 6 customer1
item3 grpA 5 9 customer1
item4 grpA 0 0 customer2
item5 grpA 9 1 customer2
objective:
output a file for each customer ($5) with the item number ($1) only if $2 matches... (2 Replies)
Discussion started by: beca123456
2 Replies
LEARN ABOUT NETBSD
cat
CAT(1) BSD General Commands Manual CAT(1)NAME
cat -- concatenate and print files
SYNOPSIS
cat [-beflnstuv] [-] [file ...]
DESCRIPTION
The cat utility reads files sequentially, writing them to the standard output. The file operands are processed in command line order. A
single dash represents the standard input, and may appear multiple times in the file list.
The word ``concatenate'' is just a verbose synonym for ``catenate''.
The options are as follows:
-b Implies the -n option but doesn't number blank lines.
-e Implies the -v option, and displays a dollar sign ('$') at the end of each line as well.
-f Only attempt to display regular files.
-l Set an exclusive advisory lock on the standard output file descriptor. This lock is set using fcntl(2) with the F_SETLKW command.
If the output file is already locked, cat will block until the lock is acquired.
-n Number the output lines, starting at 1.
-s Squeeze multiple adjacent empty lines, causing the output to be single spaced.
-t Implies the -v option, and displays tab characters as '^I' as well.
-u The -u option guarantees that the output is unbuffered.
-v Displays non-printing characters so they are visible. Control characters print as '^X' for control-X; the delete character (octal
0177) prints as '^?'. Non-ascii characters (with the high bit set) are printed as 'M-' (for meta) followed by the character for the
low 7 bits.
EXIT STATUS
The cat utility exits 0 on success, and >0 if an error occurs.
EXAMPLES
The command:
cat file1
will print the contents of file1 to the standard output.
The command:
cat file1 file2 > file3
will sequentially print the contents of file1 and file2 to the file file3, truncating file3 if it already exists. See the manual page for
your shell (i.e., sh(1)) for more information on redirection.
The command:
cat file1 - file2 - file3
will print the contents of file1, print data it receives from the standard input until it receives an EOF ('^D') character, print the con-
tents of file2, read and output contents of the standard input again, then finally output the contents of file3. Note that if the standard
input referred to a file, the second dash on the command-line would have no effect, since the entire contents of the file would have already
been read and printed by cat when it encountered the first '-' operand.
SEE ALSO head(1), hexdump(1), lpr(1), more(1), pr(1), tail(1), view(1), vis(1), fcntl(2)
Rob Pike, "UNIX Style, or cat -v Considered Harmful", USENIX Summer Conference Proceedings, 1983.
STANDARDS
The cat utility is expected to conform to the IEEE Std 1003.2-1992 (``POSIX.2'') specification.
The flags [-belnstv] are extensions to the specification.
HISTORY
A cat utility appeared in Version 1 AT&T UNIX. Dennis Ritchie designed and wrote the first man page. It appears to have been cat(1).
BUGS
Because of the shell language mechanism used to perform output redirection, the command ``cat file1 file2 > file1'' will cause the original
data in file1 to be destroyed! This is performed by the shell before cat is run.
BSD September 23, 2006 BSD