Sponsored Content
Top Forums Shell Programming and Scripting PERL: removing blank lines from multiple files Post 302354737 by hcclnoodles on Saturday 19th of September 2009 03:05:00 PM
Old 09-19-2009
Quote:
Originally Posted by ilikecows
Look at my above post. It does just that.
Thanks, but i really cant believe a perl one liner exists to do this, but the only way to do this omside an actual perl script is to run system() to run sed, then run system() again to run cp to copy the file back over


surely ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Adding 3 Lines to Multiple c and h files with perl

Hello, i need some help with a perl script. i need to add the lines: #ifdef LOGALLOC #include "logalloc.h" #endif // LOGALLOC To all c and h files in a project with subdirectories. Logalloc is a tool to log all *alloc and free's in a text file, it defines the *alloc funtions new.... (2 Replies)
Discussion started by: Lazzar
2 Replies

2. Shell Programming and Scripting

Removing Blank Lines

Hi i have the below lines from a file 7538 PRGRP450800PERSONAL SOAP AND BATH ADDITIV 7036 PRGRP450800PERSONAL SOAP AND BATH ADDITIV 7036 PRGRP450800PERSONAL SOAP AND BATH ADDITIV 7036... (3 Replies)
Discussion started by: dhanamurthy
3 Replies

3. Shell Programming and Scripting

removing duplicate blank lines

Hi, how to remove the blank lines from the file only If we have more than one blank line. thanks rameez (8 Replies)
Discussion started by: rameezrajas
8 Replies

4. UNIX for Dummies Questions & Answers

Removing blank lines in a file

Hi I have a text file that has blank lines at different places. How to remove all the blank lines in a file? Thanks Ashok (3 Replies)
Discussion started by: ashok.k
3 Replies

5. UNIX for Dummies Questions & Answers

Removing Lines Shared by Multiple Files

Hey everyone, I have a question about comparing two files. I have two lists of files. The first list, todo.csv, lists a series of compounds my supervisor wants me to perform calculations on. The second list, done.csv, lists a series of compounds that I have already performed calculations on.... (2 Replies)
Discussion started by: Stuart Ness
2 Replies

6. UNIX for Dummies Questions & Answers

Removing blank lines not working

In my bash script I want to echo lines in a file and ensure no blank lines are echoed:for i in $(cat txt) do echo $i | sed 's/|/ /g;s/ SEARCHTERM$//g;s/ /\r\n/g;s/^$/d' done Keep in mind this is a fragment so ignore the fact that the for loop is not closed. When I add the "s/^$/d' per... (12 Replies)
Discussion started by: MaindotC
12 Replies

7. Shell Programming and Scripting

Removing blank lines from a file

Hi All, How do i remove continuos blank lines from a file. I have a file with data: abc; def; ghi; jkl; mno; pqr; In the above file, there are two blank lines. I want to remove, one out of them. My output should look like: (2 Replies)
Discussion started by: raosr020
2 Replies

8. Shell Programming and Scripting

Removing blank lines

Hi, my input file is like this I want to remove the blank line. "/home/rit/sandbox/garuda/data/test/woman/T_RITK_F0008_ML_100080039.lab" r a N e l a k sh a m . "/home/rit/sandbox/garuda/data/test/woman/T_RITK_F0008_ML_100070453.lab" a v a s (4 Replies)
Discussion started by: sreejithalokkan
4 Replies

9. Shell Programming and Scripting

Removing multiple lines from input file, if multiple lines match a pattern.

GM, I have an issue at work, which requires a simple solution. But, after multiple attempts, I have not been able to hit on the code needed. I am assuming that sed, awk or even perl could do what I need. I have an application that adds extra blank page feeds, for multiple reports, when... (7 Replies)
Discussion started by: jxfish2
7 Replies

10. Shell Programming and Scripting

Removing carriage returns from multiple lines in multiple files of different number of columns

Hello Gurus, I have a multiple pipe separated files which have records going over multiple Lines. End of line separator is \n and records going over multiple lines have <CR> as separator. below is example from one file. 1|ABC DEF|100|10 2|PQ RS T|200|20 3| UVWXYZ|300|30 4| GHIJKL|400|40... (7 Replies)
Discussion started by: dJHa
7 Replies
Dist::Zilla::Plugin::Run(3pm)				User Contributed Perl Documentation			     Dist::Zilla::Plugin::Run(3pm)

NAME
Dist::Zilla::Plugin::Run - Run external commands at specific phases of Dist::Zilla VERSION
version 0.013 SYNOPSIS
[Run::BeforeRelease] run = script/myapp_before1.pl %s run = script/myapp_before2.pl %n %v [Run::Release] run = script/myapp_deploy1.pl %s run = deployer.pl --dir %d --tgz %a --name %n --version %v [Run::AfterRelease] run = script/myapp_after.pl %s %v ; %p can be used as the path separator if you have contributors on a different OS run = script%pmyapp_after.pl %s %v DESCRIPTION
Run arbitrary commands at various Dist::Zilla phases. CONVERSIONS
The following conversions/format specifiers are defined for passing as arguments to the specified commands (though not all values are available at all phases). o %a the archive of the release (available to all *Release phases) o %d the directory in which the dist was built (not in "BeforeBuild") o %n the dist name o %p path separator ('/' on Unix, '\' on Win32... useful for cross-platform dist.ini files) o %v the dist version o %x full path to the current perl interpreter (like $^X but from Config) Additionally %s is retained for backward compatibility. Each occurrence is replaced by a different value (like the regular "sprintf" function). Individual plugins define their own values for the positional replacement of %s. AUTHOR
Torsten Raudssus <torsten@raudssus.de> <http://www.raudssus.de/> COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by Raudssus Social Software <http://www.raudssus.de/>. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.12.4 2011-11-09 Dist::Zilla::Plugin::Run(3pm)
All times are GMT -4. The time now is 03:27 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy