Sponsored Content
Top Forums Shell Programming and Scripting Can't remove blank lines from a file Post 302396484 by Corona688 on Thursday 18th of February 2010 02:30:54 PM
Old 02-18-2010
You realize of course that none of the commands you've given actually edits the given file. Just checking the obvious here. Smilie

Since this is cygwin another culprit may be the CPM-style carriage returns Windows text files have. Annoyingly, plenty of things can't actually match a carriage return.

Code:
tr -d '\r' < input | grep -v "^$" > output

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Remove blank lines

¿How can i remove blank lines between all lines in a long text file? Example WrongFile.txt : Line 1 Line 2 Line 3 CorrectFile.txt : Line 1 Line 2 Line 3 Thanks in advance :confused: (4 Replies)
Discussion started by: osymad
4 Replies

2. UNIX for Dummies Questions & Answers

remove blank lines in *.srt file :)

Hi all, I use translate web to get subtitle file in my langues . But in output file have bad blank lines . I need scrip (i use debian ) to remove this blank lines . szintax of my bad *.srt file : ------ number blank1 number:number ---> number:number blank2 text1 . textn blankS... (10 Replies)
Discussion started by: hungbp
10 Replies

3. Shell Programming and Scripting

remove blank lines

I have joined 2 files. Join command worked fine. but the result showing extra blank lines. I tried to remove blank spaces by using awk (-- -42 RS= ORS="\n\n" file.txt) and sed (sed '/^ *$/d' file.txt)commands but didn't remove any Any suggestions plz:D 123 tab ....... ......tab .......234... (3 Replies)
Discussion started by: repinementer
3 Replies

4. UNIX for Dummies Questions & Answers

Remove blank lines and comments from text file

Hi, I am using BASH. How can I remove any lines in a text file that are either blank or begin with a # (ie. comments)? Thanks in advance. Mike (3 Replies)
Discussion started by: msb65
3 Replies

5. Shell Programming and Scripting

Remove blank lines

I really hope someone can help me with this. I have several php files from a forum that I run, that now for some reason have blank lines after every line. Is there an easy way to make a script that does the following: * If there are consecutive blank lines, delete all of them except one. * If... (9 Replies)
Discussion started by: KidCactus
9 Replies

6. Shell Programming and Scripting

remove blank lines and merge lines in shell

Hi, I'm not a expert in shell programming, so i've come here to take help from u gurus. I'm trying to tailor a csv file that i got to make it work for the LOAD FROM command. I've a datatable csv of the below format - --in file format xx,xx,xx ,xx , , , , ,,xx, xxxx,, ,, xxx,... (11 Replies)
Discussion started by: dvah
11 Replies

7. Shell Programming and Scripting

How to remove blank lines

Hi, I am facing a problem related to removing blank lines from a text document. Input Error 17-05-2011 11:01:15 VisualSVN Server 2.1 1001 The following information was included with the event: line3 line4 Error 17-05-2011 11:00:25 VisualSVN Server 2.1 ... (13 Replies)
Discussion started by: mayursingru
13 Replies

8. UNIX and Linux Applications

remove all blank lines

When I 'vi' my test file I see some blank lines. However once I do :set list to display hidden characters, I see the empty lines literally like this: ^I$ How do I remove them? I cannot find a regex to match them. (3 Replies)
Discussion started by: alexsuv
3 Replies

9. Shell Programming and Scripting

How to remove blank lines in a file and save the file with same name?

I have a text file which has blank lines. I want them to be removed before upload it to DB using SQL *Loader. Below is the command line, i use to remove blank lines. sed '/^ *$/d' /loc/test.txt If i use the below command to replace the file after removing the blank lines, it replace the... (6 Replies)
Discussion started by: vel4ever
6 Replies

10. Shell Programming and Scripting

Remove Blank lines in VI

Hi, Which option is used to remove blank lines in VI (AIX). ? Regards, Siva (6 Replies)
Discussion started by: ksgnathan
6 Replies
FSCK.CPM(1)							   User commands						       FSCK.CPM(1)

NAME
fsck.cpm - check a CP/M file system SYNOPSIS . fsck.cpm [-f format] [-n] image DESCRIPTION . fsck.cpm is used to check and repair a CP/M file system. After reading the directory, it makes two passes. The first pass checks extent fields for range and format violations (bad status, extent number, last record byte count, file name, extension, block number, record count, size of .COM files, time stamp format, invalid password characters, invalid time stamp mode). The second pass checks extent connec- tivity (multiple allocated blocks and duplicate directory entries). fsck.cpm can not yet repair all errors. OPTIONS . -f format Use the given CP/M disk format instead of the default format. -n Open the file system read-only and do not repair any errors. RETURN VALUE . Upon successful completion, exit code 0 is returned. ERRORS . Any errors are indicated by exit code 1. FILES . /etc/cpmtools/diskdefs CP/M disk format definitions DIAGNOSTICS . image: used/total files (n.n% non-contiguous), used/total blocks" No inconsistencies could be found. The number of used files actually is the number of used extents. Since a file may use more than one extent, this may be greater than the actual number of files, but a correct measure would not reflect how many files could still be created at most. A file is considered fragmented, if sequential data blocks pointed to by the same extent do not have sequential block numbers. The number of used blocks includes the blocks used for system tracks and the directory. AUTHORS . This program is copyright 1997-2010 Michael Haardt <michael@moria.de>. The Windows port is copyright 2000, 2001 John Elliott <jce@seasip.demon.co.uk>. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. SEE ALSO . fsck(8), mkfs.cpm(1), cpm(5) CP
/M tools March 30, 2010 FSCK.CPM(1)
All times are GMT -4. The time now is 06:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy