08-15-2018
thanks I've tried that now but I still have the same problem as when using the code from my second post.
With the files containing different numbers as in my first post, I get empty lines as first and last line.
Since my data is not in columns but in one line for file1, and they are a part of a cshell script and come as results in a loop,it would be difficult to be sure that it will never have any extra characters, I would rather keep them as a one line instead of converting to a column.
Is there a way to use indices with lines as with the columns in awk?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello all,
I always found help for my problems using the search option, but this time my request is too specific. I have two files that I want to compare. File1 is the index and File2 contains the data:
File1:
chr1 protein_coding exon 500 600 . + . gene_id "20532";... (0 Replies)
Discussion started by: DerSeb
0 Replies
2. Shell Programming and Scripting
Hi guys,
I'm rather new at using UNIX based systems, and when it comes to scripting etc I'm even newer.
I have two files which i need to compare.
file1: (some random ID's)
451245
451288
136588
784522
file2: (random ID's + e-mail assigned to ID)
123888 xc@xc.com
451245 ... (21 Replies)
Discussion started by: spirm8
21 Replies
3. UNIX for Dummies Questions & Answers
I have two text files where the first three columns are exactly the same. I want to compare the fourth column of the text files and if the values are different, print that row into a new output file. How do I go about doing that?
File 1:
100 rs3794811 0.01 0.3434
100 rs8066551 0.01... (8 Replies)
Discussion started by: evelibertine
8 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have two text files with matching first columns. Some of the values in the second column do not match. I want to write a script to print out the rows (only the first column) where the values in the second column do not match.
Example:
Input 1
A 1
B 2
C 3
D 4
Input 2
A 2
B 2... (6 Replies)
Discussion started by: evelibertine
6 Replies
5. Shell Programming and Scripting
Hi All,
I want to compare two files using shell script. One file will be input file and each line of input file will be compared against the other file.
for e.g.
File 1
10.3.242.170 saquatch Tesr.adc.unix.com jndi_p1 jndi_p1.unix.com
10.3.242.171 ness... (10 Replies)
Discussion started by: sharsour
10 Replies
6. Shell Programming and Scripting
I'm looking to match an error code against a list of possible codes and get the nearest match. The code would be a 6 character hexadecimal string.
I have a file of error codes all of which have a specific first 3 characters, however, after that the last 3 characters may be specific or generic as... (3 Replies)
Discussion started by: dazedandconfuse
3 Replies
7. Shell Programming and Scripting
Hi,
I have been trying to find help with my issue and I'm thinking awk may be able to do it.
I have two files eg
file1.txt
STRING1 230 400 0.36
STRING2 400 230 -0.13
STRING3 130 349 1
file2.txt
CUFFFLINKS 1 1394 93932 . + STRING1
CUFFFLINKS ... (9 Replies)
Discussion started by: zward
9 Replies
8. Shell Programming and Scripting
Hello all, First post here. I did not notice a previous post to help me down the right path. I am looking to compare a column in a CSV file against another file (which is not a column match one for one) but more or less when a match is made, I would like to append a third column that contains a... (17 Replies)
Discussion started by: dis0wned
17 Replies
9. UNIX for Beginners Questions & Answers
I have two file as given below which shows the ACL permissions of each file. I need to compare the source file with target file and list down the difference as specified below in required output. Can someone help me on this ?
Source File
*************
# file: /local/test_1
# owner: own
#... (4 Replies)
Discussion started by: sarathy_a35
4 Replies
10. Shell Programming and Scripting
I have a file with contents as shown in file.texi
Would like to keep only the sections that have inlineifset till the empty line is reached. Finally replace the
following string with a space
@inlineifset{mrg, @opar{@bullet{}
I had written the following command but it messed my file
... (6 Replies)
Discussion started by: Danette
6 Replies
LEARN ABOUT DEBIAN
lsdiff
LSDIFF(1) Man pages LSDIFF(1)
NAME
lsdiff - show which files are modified by a patch
SYNOPSIS
lsdiff [[-n] | [--line-number]] [[-p n] | [--strip-match=n]] [--strip=n] [--addprefix=PREFIX] [[-s] | [--status]] [[-E] |
[--empty-files-as-removed]] [[-i PATTERN] | [--include=PATTERN]] [[-x PATTERN] | [--exclude=PATTERN]] [[-z] | [--decompress]]
[[-# RANGE] | [--hunks=RANGE]] [--lines=RANGE] [--files=RANGE] [[-H] | [--with-filename]] [[-h] | [--no-filename]] [[-v] |
[--verbose]...] [file...]
lsdiff {[--help] | [--version] | [--filter ...] | [--grep ...]}
DESCRIPTION
List the files modified by a patch.
You can use both unified and context format diffs with this program.
OPTIONS
-n, --line-number
Display the line number that each patch begins at. If verbose output is requested (using -nv), each hunk of each patch is listed as
well.
For each file that is modified, a line is generated containing the line number of the beginning of the patch, followed by a Tab
character, followed by the name of the file that is modified. If -v is given once, following each of these lines will be one line for
each hunk, consisting of a Tab character, the line number that the hunk begins at, another Tab character, the string "Hunk #", and the
hunk number (starting at 1).
If the -v is given twice in conjunction with -n (i.e. -nvv), the format is slightly different: hunk-level descriptive text is shown
after each hunk number, and the --number-files option is enabled.
--number-files
File numbers are listed, beginning at 1, before each filename.
-# RANGE, --hunks=RANGE
Only list hunks within the specified RANGE. Hunks are numbered from 1, and the range is a comma-separated list of numbers or
"first-last" spans; either the first or the last in the span may be omitted to indicate no limit in that direction.
--lines=RANGE
Only list hunks that contain lines from the original file that lie within the specified RANGE. Lines are numbered from 1, and the range
is a comma-separated list of numbers or "first-last" spans; either the first or the last in the span may be omitted to indicate no
limit in that direction.
--files=RANGE
Only list files indicated by the specified RANGE. Files are numbered from 1 in the order they appear in the patch input, and the range
is a comma-separated list of numbers or "first-last" spans; either the first or the last in the span may be omitted to indicate no
limit in that direction.
-p n, --strip-match=n
When matching, ignore the first n components of the pathname.
--strip=n
Remove the first n components of the pathname before displaying it.
--addprefix=PREFIX
Prefix the pathname with PREFIX before displaying it.
-s, --status
Show file additions, modifications and removals. A file addition is indicated by a "+", a removal by a "-", and a modification by a
"!".
-E, --empty-files-as-removed
Treat empty files as absent for the purpose of displaying file additions, modifications and removals.
-i PATTERN, --include=PATTERN
Include only files matching PATTERN.
-x PATTERN, --exclude=PATTERN
Exclude files matching PATTERN.
-z, --decompress
Decompress files with extensions .gz and .bz2.
-H, --with-filename
Print the name of the patch file containing each patch.
-h, --no-filename
Suppress the name of the patch file containing each patch.
-v, --verbose
Verbose output.
--help
Display a short usage message.
--version
Display the version number of lsdiff.
--filter
Behave like filterdiff(1) instead.
--grep
Behave like grepdiff(1) instead.
SEE ALSO
filterdiff(1), grepdiff(1)
EXAMPLES
To sort the order of touched files in a patch, you can use:
lsdiff patch | sort -u |
xargs -rn1 filterdiff patch -i
To show only added files in a patch:
lsdiff -s patch | grep '^+' |
cut -c2- | xargs -rn1 filterdiff patch -i
To show the headers of all file hunks:
lsdiff -n patch | (while read n file
do sed -ne "$n,$(($n+1))p" patch
done)
AUTHOR
Tim Waugh <twaugh@redhat.com>
Package maintainer
patchutils 23 Jan 2009 LSDIFF(1)