Sponsored Content
Full Discussion: Remove blank lines
Top Forums Shell Programming and Scripting Remove blank lines Post 302459463 by panyam on Monday 4th of October 2010 05:34:58 PM
Old 10-04-2010
Quote:
Originally Posted by KidCactus
Awesome, thank you! That works like a charm, exactly how I want it. Smilie Smilie

---------- Post updated at 10:31 PM ---------- Previous update was at 10:16 PM ----------

If I would want to do this on a number of .php files in a folder and get the output from each file as filename_2.php, how can I script that too?
Code:
 
for file_name in *.php
do
---your awk statement $file_name > ${file_name}"_2".php
done

This User Gave Thanks to panyam For This Post:
 

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. UNIX for Advanced & Expert Users

How to Remove the unwanted Blank Lines

I have a file with the below data, i would like to remove the end blank lines with no data. I used the below commands but could not able to succeed, could you please shed some light. Commands Used: sed '/^$/d' input.txt > output.txt grep -v '^$' input.txt > output.txt input.txt file... (5 Replies)
Discussion started by: Ariean
5 Replies

4. 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

5. Shell Programming and Scripting

Can't remove blank lines from a file

Hi Guys, I have been trying to remove blank lines from a file with no success. I tried using all the following options on the file: tr -s '\n' < abc.txt grep -v "^$" abc.txt sed '/^$/d' abc.txt sed '/./!d' abc.txt awk '/./' abc.txt The file is a text file. (11 Replies)
Discussion started by: npatwardhan
11 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

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

10. UNIX for Dummies Questions & Answers

Remove blank lines using cat command

plz help me to figure it out how i remove empty or blank files using cat command. i will be very thankful if u send me this answer... thanks (3 Replies)
Discussion started by: mushfiks1
3 Replies
codechanges(1)						      General Commands Manual						    codechanges(1)

NAME
codechanges - computes the amount of code changes between two code trees or single files SYNOPSIS
codechanges [-n] old-directory new-directory codechanges [-n] old-file new-file DESCRIPTION
codechanges recursively compares the two named directories (or files) calculating new/deleted/changed lines, not including comments or blank lines, in files which appear to be source files (C, C++, shell, and Makefiles). To include comments and blank lines, use the -n option. APPLICATIONS
codechanges is purpose designed to measure the amount of code change between milestones in a project's life. The following output is from two stages, plus some artificial test cases, in the pmccabe code stream: NEW DELETED CHANGED Old File, New File 11 19 4 old.pmccabe/./Makefile pmccabe/./Makefile 214 10 39 old.pmccabe/./cparse.c pmccabe/./cparse.c 463 0 0 NEWFILE pmccabe/./decomment.c 147 4 39 old.pmccabe/./dmain.c pmccabe/./dmain.c 10 0 0 NEWFILE pmccabe/./dmain.h 407 0 0 NEWFILE pmccabe/./getopt.c 48 0 0 NEWFILE pmccabe/./getopt.h 9 18 12 old.pmccabe/./gettoken.c pmccabe/./gettoken.c 18 18 15 old.pmccabe/./io.c pmccabe/./io.c 175 43 20 old.pmccabe/./nmain.c pmccabe/./nmain.c 194 11 22 old.pmccabe/./pmccabe.c pmccabe/./pmccabe.c 42 0 20 old.pmccabe/./pmccabe.h pmccabe/./pmccabe.h 0 1318 0 old.pmccabe/./test/langMode.c DELETED 24 0 0 NEWFILE pmccabe/./test006/Grapher.H 620 0 0 NEWFILE pmccabe/./test006/Handler.H 442 0 0 NEWFILE pmccabe/./test006/NodeArc.H 764 0 0 NEWFILE pmccabe/./w/parser.C 95 0 0 NEWFILE pmccabe/./w/tokens.h 4 0 0 NEWFILE pmccabe/./x.sh 3687 1441 171 TOTAL DIAGNOSTICS
There aren't many at this time. BUGS
codechanges thinks it knows what source files are interesting and the user may not agree with its choices. It's a script and should be easy to modify. Ultimately this should probably be configurable. codechanges uses a program called decomment which guesses how to de-comment a file based on its file name and it's not always perfect. AUTHOR
Paul Bame SEE ALSO
pmccabe(1), decomment(1) HP
12Feb2003 codechanges(1)
All times are GMT -4. The time now is 12:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy