Thank You so much. It worked, as you said the spaces between the fields are gone.
---------- Post updated 05-17-12 at 12:25 AM ---------- Previous update was 05-16-12 at 11:36 AM ----------
In some environments, the file has around 800 lines hence it is difficult to read from the file. This output will be generated 30 mins once and 24/7. I am trying to add spaces upon identification of a space, but this is failing to give the output in a formatted manner. Can you please help. A portion of output is printed below.
Hi guys I want to print the values by using this script but its giving the no of rows and columns as input instead of values
Would you plz help me on this
FILE- chr1.txt
1981 1
1971 1
1961 1
1941 1
perl script
#!/usr/bin/perl -w
$infile1 = 'chr1.txt';
$outfile3 = 'out3.txt';
... (3 Replies)
I have read another post about this issue and am wondering how to adapt it
to my own, much simpler, issue.
I have a file of user IDs like so:
333333
321321
546465
...etc
I need to take each number and use it to print records wherein the 5th
field matches the user ID pulled from the... (2 Replies)
Hi, Guys. Please help me to find solution to this problem using shell scripting.
I have an INPUT file with 4 columns separated by tab. Each block of records is separated by -----
-----
Sample1 5402 6680 Pattern01
Sample2 2216 2368 Pattern02... (6 Replies)
Hi everyone,
I have file1 and file2 comma separated both.
file1 is:
Header1,Header2,Header3,Header4,Header5,Header6,Header7,Header8,Header9,Header10
Code7,,,,,,,,,
Code5,,,,,,,,,
Code3,,,,,,,,,
Code9,,,,,,,,,
Code2,,,,,,,,,file2... (17 Replies)
Hello Friends,
I have a CDR file and i need to print out 2 columns with their field position which matches to some constant values,
a part of input file
CZ=1|CZA=1|DIAL=415483420001|EE=13|ESF=1|ET=|FF=0|9|MNC=99|MNP=9041|MTC=0|NID=2|NOA=international|ON=1|
OutPut
... (3 Replies)
Hi Experts,
I am trying to get the output from a matching pattern but unable to construct the awk command:
file :
aa bb cc 11
dd aa cc 33
cc 22 45 68
aa 33 44 44
dd aa cc 37
aa 33 44 67
I want the output to be : ( if $1 match to "aa" start of the line,then print $4 of that line, and... (3 Replies)
Hello,
I have two files file 1 and file 2 each having result of a query on certain database tables and need to compare for Col1 in file1 with Col3 in file2, compare Col2 with Col4 and output the value of Col1 from File1 which is a) not present in Col3 of File2 b) value of Col2 is different from... (2 Replies)
I want to print only the lines in file2 that match file1, in the same order as they appear in file 1
file1
file2
desired output:
I'm getting the lines to match
awk 'FNR==NR {a++}; FNR!=NR && a' file1 file2
but they are in sorted order, which is not what I want:
Can anyone... (4 Replies)
I would like to compare values in column 8, and grep the ones where the different is > 1, columns 1 and 2 are the key for array.
Every 4 rows the records values in columns 1 and 2 changed. Then, the comparison in the column 8 need to be done for the 4 rows everytime columns 1 and 2 changed
... (4 Replies)
Discussion started by: jiam912
4 Replies
LEARN ABOUT NETBSD
diff
DIFF(1) User Commands DIFF(1)NAME
diff - compare files line by line
SYNOPSIS
diff [OPTION]... FILES
DESCRIPTION
Compare files line by line.
-i--ignore-case
Ignore case differences in file contents.
--ignore-file-name-case
Ignore case when comparing file names.
--no-ignore-file-name-case
Consider case when comparing file names.
-E--ignore-tab-expansion
Ignore changes due to tab expansion.
-b--ignore-space-change
Ignore changes in the amount of white space.
-w--ignore-all-space
Ignore all white space.
-B--ignore-blank-lines
Ignore changes whose lines are all blank.
-I RE --ignore-matching-lines=RE
Ignore changes whose lines all match RE.
--strip-trailing-cr
Strip trailing carriage return on input.
-a--text
Treat all files as text.
-c-C NUM --context[=NUM]
Output NUM (default 3) lines of copied context.
-u-U NUM --unified[=NUM]
Output NUM (default 3) lines of unified context.
--label LABEL
Use LABEL instead of file name.
-p--show-c-function
Show which C function each change is in.
-F RE --show-function-line=RE
Show the most recent line matching RE.
-q--brief
Output only whether files differ.
-e--ed
Output an ed script.
--normal
Output a normal diff.
-n--rcs
Output an RCS format diff.
-y--side-by-side
Output in two columns.
-W NUM --width=NUM
Output at most NUM (default 130) print columns.
--left-column
Output only the left column of common lines.
--suppress-common-lines
Do not output common lines.
-D NAME --ifdef=NAME
Output merged file to show `#ifdef NAME' diffs.
--GTYPE-group-format=GFMT
Similar, but format GTYPE input groups with GFMT.
--line-format=LFMT
Similar, but format all input lines with LFMT.
--LTYPE-line-format=LFMT
Similar, but format LTYPE input lines with LFMT.
LTYPE is `old', `new', or `unchanged'.
GTYPE is LTYPE or `changed'.
GFMT may contain:
%< lines from FILE1
%> lines from FILE2
%= lines common to FILE1 and FILE2
%[-][WIDTH][.[PREC]]{doxX}LETTER
printf-style spec for LETTER
LETTERs are as follows for new group, lower case for old group:
F first line number
L last line number
N number of lines = L-F+1
E F-1
M L+1
LFMT may contain:
%L contents of line
%l contents of line, excluding any trailing newline
%[-][WIDTH][.[PREC]]{doxX}n
printf-style spec for input line number
Either GFMT or LFMT may contain:
%% %
%c'C' the single character C
%c'OOO'
the character with octal code OOO
-l--paginate
Pass the output through `pr' to paginate it.
-t--expand-tabs
Expand tabs to spaces in output.
-T--initial-tab
Make tabs line up by prepending a tab.
-r--recursive
Recursively compare any subdirectories found.
-N--new-file
Treat absent files as empty.
--unidirectional-new-file
Treat absent first files as empty.
-s--report-identical-files
Report when two files are the same.
-x PAT --exclude=PAT
Exclude files that match PAT.
-X FILE --exclude-from=FILE
Exclude files that match any pattern in FILE.
-S FILE --starting-file=FILE
Start with FILE when comparing directories.
--from-file=FILE1
Compare FILE1 to all operands. FILE1 can be a directory.
--to-file=FILE2
Compare all operands to FILE2. FILE2 can be a directory.
--horizon-lines=NUM
Keep NUM lines of the common prefix and suffix.
-d--minimal
Try hard to find a smaller set of changes.
--speed-large-files
Assume large files and many scattered small changes.
-v--version
Output version info.
--help Output this help.
FILES are `FILE1 FILE2' or `DIR1 DIR2' or `DIR FILE...' or `FILE... DIR'. If --from-file or --to-file is given, there are no restrictions
on FILES. If a FILE is `-', read standard input.
AUTHOR
Written by Paul Eggert, Mike Haertel, David Hayes, Richard Stallman, and Len Tower.
REPORTING BUGS
Report bugs to <bug-gnu-utils@gnu.org>.
COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc.
This program comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of this program under the terms of the
GNU General Public License. For more information about these matters, see the file named COPYING.
SEE ALSO
The full documentation for diff is maintained as a Texinfo manual. If the info and diff programs are properly installed at your site, the
command
info diff
should give you access to the complete manual.
diffutils 2.8.1 April 2002 DIFF(1)