Hello,
I have not been able to find what I'm looking for via searching the forum. I could use some help with an awk script or one-liner to solve this simple problem.
I have two files. If $1 and $2 from file1 match $1 and $2 from file2, print the whole line from file2.
Example file1
... (2 Replies)
Hello. I have two files. FILE1 was extracted from FILE2 and modified thanks to help from this post. Now I need to replace the extracted, modified lines into the original file (FILE2) to produce the FILE3.
FILE1
1466 55.27433 14.72050 -2.52E+03 3.00E-01 1.05E+04 2.57E+04
1467 55.27433... (1 Reply)
Hi
I have file 1 like this
and file 2 like this
I need to compare column 3 of both files and delete lines in file1 with same column 3 values in two files. So the output is
I tried with perl but didnt work. A perl code will be good as I am learning the language, but any other code would... (1 Reply)
Hi dear users,
I need to compare numeric columns in two files. These files have the following structure.
K.txt (4 columns)
A001 chr21 9805831 9846011
A002 chr21 9806202 9846263
A003 chr21 9887188 9988593
A003 chr21 9887188 ... (2 Replies)
Hi,
I want to compare the columns of two files excluding column 2 from both the files. I tried this awk command.
awk -F":" 'NR==FNR{++a;next} !(a)' file1.txt file2.txt
.
Example: File1.txt
123:09-15-2011:abc:123456
123:09-15-2011:abc:234567
123:09-15-2011:abc:345678
... (5 Replies)
Hi,
I want to compare two columns from file1 with another two column of file2 and print matched and unmatched column like this
File1
1 rs1 abc
3 rs4 xyz
1 rs3 stu
File2
1 kkk rs1 AA 10
1 aaa rs2 DD 20
1 ccc ... (2 Replies)
Hi all, I'm pretty much a newbie to UNIX. I would appreciate any help with UNIX coding on comparing two large csv files (greater than 10 GB in size), and output a file with matching columns.
I want to compare file1 and file2 by 'id' and 'chain' columns, then extract exact matching rows'... (5 Replies)
Hi,
Below is my requirement
file1
id|cnt
1|1
2|2
3|3
file2
id_1|cnt_1
1|1
2|1
3|1
I want to compare cnt and cnt_1 columns, if they are differ then give the details
Am using below awk command, but the output is not as expected. (2 Replies)
Discussion started by: grandhirahuletl
2 Replies
LEARN ABOUT OSF1
fmt
fmt(1) General Commands Manual fmt(1)NAME
fmt - Formats mail messages prior to sending
SYNOPSIS
fmt [-width] file...
DESCRIPTION
The fmt command reads the input file or files, or standard input if no files are specified, and writes to standard output a version of the
input with lines of a length as close as possible to width columns. (Because fmt is internationalized software, the number of display col-
umns is not necessarily equivalent to the number of bytes.)
The fmt command both joins and splits lines to achieve the desired width, but words are never joined or split; spaces are always preserved,
and lines are split at spaces only. In effect, fmt ignores newline characters in the input and wraps words to make lines a close as possi-
ble to width columns, resulting in individual lines of varying length but a consistent (new) text width overall. Because blank lines are
always preserved, fmt does not merge paragraphs separated by blank lines.
If you specify more than one file, the files are concatenated as input to fmt. If you do not specify -width, the default line length is 72
columns. Spacing at the beginning of input lines is always preserved in the output.
The fmt command is generally used to format mail messages to improve their appearance before they are sent. It may also be useful, how-
ever, for other simple formatting tasks. For example, when you are using vi, you can use the command :%!fmt -60 to reformat your text so
that all lines are approximately 60 columns long.
NOTES
The fmt command is a fast, simple formatting program. Standard text editing programs are more appropriate than fmt for complex formatting
operations. Do not use the fmt command if the message contains embedded messages or preformatted information from other files. This com-
mand formats the heading information in embedded messages and may change the format of preformatted information.
EXAMPLES
file1 contains these lines:
Australia is an island-continent, home to many very interesting plants and animals.
To reformat this text to a narrower width, enter: fmt -30 file1
This results in the following, displayed on your screen: Australia is an island-continent, home to many very interesting plants and
animals.
To make file1 wider, enter: fmt -60 file1
This results in: Australia is an island-continent, home to many very interesting plants and animals. To format a message you have
created with the mailx editor, at the left margin enter: ~|fmt
After you enter the command, your message is formatted, in this case to the default line length of 72 columns, and the word continue
is displayed to indicate that you can enter more information or send your message.
SEE ALSO
Commands: mail(1), mailx(1), vi(1)fmt(1)