02-10-2015
Please be more precise - do you want to eliminate ALL spaces even though they might be field separators? What about <TAB>s? Are lines that contain nothing but white space to be considered "blank" lines?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi there
i'm trying to delete blank lines and or lines with spaces only from a series of files in an directory.
to do so, i'm using this:
for files in `ls /users/myname/pesop* 2>/dev/null`
do
grep -v ^$ $files > newfile
mv newfile $files
done
now, this works great for blank lines but... (3 Replies)
Discussion started by: vascobrito
3 Replies
2. Shell Programming and Scripting
can't figure out a way to delete multiple empty lines but keep single empty lines in a file, file is like this
#cat file
1
2
3
4
5
6
-
What I want is
1
2 (6 Replies)
Discussion started by: fedora
6 Replies
3. Shell Programming and Scripting
I am attempting to delete blank lines in my file and I've used this command:
sed '/^$/d' $file > $file.fixed
all this seems to do is copy the file and not delete the blank lines located at the end of the file. Any assistance would be greatly appreciated. (3 Replies)
Discussion started by: TL56
3 Replies
4. UNIX for Dummies Questions & Answers
can anyone show me how to delete blank lines from a file.
thanks in advance (2 Replies)
Discussion started by: sachin.gangadha
2 Replies
5. Shell Programming and Scripting
Hi,
I want to use diff to compare two files in a Perl file. But one of the files has some blank lines at the end. So I want to delete the blank lines from the file firstly and then use diff to compare them. But I dont know how to delete the blank lines from the files. Meanwhile, the system is... (5 Replies)
Discussion started by: Damon_Qu
5 Replies
6. Shell Programming and Scripting
Hi,
Consider a file named "testfile"
The contents of file are as below
first line added for test
second line added for test
third line added for test
fourth line added for test
fifth line added for test (5 Replies)
Discussion started by: anil8103
5 Replies
7. Shell Programming and Scripting
Hi All,
I have a file and I need to delete the lines that are blank and is starting with some characters below. Something like below:
Regular Ascii File:
Line1: AGODA1 BUSAN||SK Lord Beach 4/6/2012 4/7/2012 68060
Line2: AGODA2 BUSAN||SK Beach Hotel 4/6/2012 4/7/2012 610200
Line3: ... (4 Replies)
Discussion started by: rkumar28
4 Replies
8. Shell Programming and Scripting
Hello All,
I have a file with data as below. Each line consists of 21 fields. I am not able to load them back to the database.
50733339,"834","834 ","005010X279A1","N","Y","007977163","0001 ",30,"2110D ","EB ","EB007 ","2 ","Conditional Required Data Element Miss
ing... (3 Replies)
Discussion started by: Praveenkulkarni
3 Replies
9. Shell Programming and Scripting
Hi All
Need Help
I have a file with the below format (ABC.TXT) :
®¿¿ABCDHEJJSJJ|XCBJSKK01|M|7348974982790
HDFLJDKJSKJ|KJALKSD02|M|7378439274898
KJHSAJKHHJJ|LJDSAJKK03|F|9898982039999
(cont......)
I need to write a script where it will check for : blank lines (between rows,before... (6 Replies)
Discussion started by: chatwithsaurav
6 Replies
10. Shell Programming and Scripting
Hi,
I tried the following options but was unable to delete blank lines from file
Input file = temp.hash.txt
temp.hash.txt content
90
0
89.56
0
0
57575.4544
56.89 (9 Replies)
Discussion started by: uuuunnnn
9 Replies
SDIFF(1) GNU Tools SDIFF(1)
NAME
sdiff - find differences between two files and merge interactively
SYNOPSIS
sdiff -o outfile [options] from-file to-file
DESCRIPTION
The sdiff command merges two files and interactively outputs the results to outfile.
If from-file is a directory and to-file is not, sdiff compares the file in from-file whose file name is that of to-file, and vice versa.
from-file and to-file may not both be directories.
sdiff options begin with -, so normally from-file and to-file may not begin with -. However, -- as an argument by itself treats the
remaining arguments as file names even if they begin with -. You may not use - as an input file.
sdiff without -o (or --output) produces a side-by-side difference. This usage is obsolete; use diff --side-by-side instead.
Options
Below is a summary of all of the options that GNU sdiff accepts. Each option has two equivalent names, one of which is a single letter
preceded by -, and the other of which is a long name preceded by --. Multiple single letter options (unless they take an argument) can be
combined into a single command line argument. Long named options can be abbreviated to any unique prefix of their name.
-a Treat all files as text and compare them line-by-line, even if they do not appear to be text.
-b Ignore changes in amount of white space.
-B Ignore changes that just insert or delete blank lines.
-d Change the algorithm to perhaps find a smaller set of changes. This makes sdiff slower (sometimes much slower).
-H Use heuristics to speed handling of large files that have numerous scattered small changes.
--expand-tabs
Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.
-i Ignore changes in case; consider upper- and lower-case to be the same.
-I regexp
Ignore changes that just insert or delete lines that match regexp.
--ignore-all-space
Ignore white space when comparing lines.
--ignore-blank-lines
Ignore changes that just insert or delete blank lines.
--ignore-case
Ignore changes in case; consider upper- and lower-case to be the same.
--ignore-matching-lines=regexp
Ignore changes that just insert or delete lines that match regexp.
--ignore-space-change
Ignore changes in amount of white space.
-l
--left-column
Print only the left column of two common lines.
--minimal
Change the algorithm to perhaps find a smaller set of changes. This makes sdiff slower (sometimes much slower).
-o file
--output=file
Put merged output into file. This option is required for merging.
-s
--suppress-common-lines
Do not print common lines.
--speed-large-files
Use heuristics to speed handling of large files that have numerous scattered small changes.
-t Expand tabs to spaces in the output, to preserve the alignment of tabs in the input files.
--text Treat all files as text and compare them line-by-line, even if they do not appear to be text.
-v
--version
Output the version number of sdiff.
-w columns
--width=columns
Use an output width of columns. Note that for historical reasons, this option is -W in diff, -w in sdiff.
-W Ignore horizontal white space when comparing lines. Note that for historical reasons, this option is -w in diff, -W in sdiff.
SEE ALSO
cmp(1), comm(1), diff(1), diff3(1).
DIAGNOSTICS
An exit status of 0 means no differences were found, 1 means some differences were found, and 2 means trouble.
GNU Tools 22sep1993 SDIFF(1)