Sponsored Content
Top Forums Shell Programming and Scripting sed over writes my original file (using sed to remove leading spaces) Post 302263418 by reborg on Monday 1st of December 2008 02:40:03 PM
Old 12-01-2008
not really, just use perl instead:
Code:
perl -pi -e 's/^ *//' foofile

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to remove spaces in a string using sed.

Hello, I have the following to remove spaces from beginning and end of a string. infile=`echo "$infilename" | sed 's/^ *//;s/ *$//` How do I modify the above code to remove spaces from beginning, end and in the middle of the string also. ex: ... (4 Replies)
Discussion started by: radhika
4 Replies

2. Shell Programming and Scripting

Remove leading zeroes in 2nd field using sed

Hi Forum. I tried searching the forum but couldn't find a solution for my question. I have the following data and would like to have a sed syntax to remove the leading zeroes from the 2nd field only: Before: 2010-01-01|123|1|1000|2000|500|1500|600|700... (18 Replies)
Discussion started by: pchang
18 Replies

3. Shell Programming and Scripting

tr and sed remove spaces. how to stop this?

if the answer is obvious, sorry, I'm new here. anyway, I'm using tr to encrypt with rot-13: echo `cat $script | tr 'a-zA-Z' 'n-za-mN-ZA-M'` > $script it works, but it removes any consecutive spaces so that there is just one space between words. I've had this problem before while using sed to... (5 Replies)
Discussion started by: Trichopterus
5 Replies

4. Shell Programming and Scripting

sed remove newlines and spaces

Hi all, i am getting count from oracle 11g by spooling it to a file. Now there are some newline characters and blank spaces i need to remove these. pl provide me a awk/sed solution. the spooled file is attached. i tried this.. but not getting req o/p (6 Replies)
Discussion started by: rishav
6 Replies

5. Shell Programming and Scripting

sed delete leading spaces in a .csv if not in a string

Solaris, ksh I have a .csv file I am trying to clean up before loading into the database. The file contains comma separated columns that have leading spaces which I need to remove. The trouble is, some columns that should not be touched are strings which happen to have the same pattern in them. ... (4 Replies)
Discussion started by: gary_w
4 Replies

6. OS X (Apple)

Remove leading spaces from file names and folders

Hi All, I have a vexing issue with leading spaces in file names. Basically, we're moving tons of data from our ancient afp file share to Box.com and Box forbids leading spaces in files or folders. The HFS file system seems to be perfectly fine with this, but almost all other Unix file systems... (1 Reply)
Discussion started by: prometheon123
1 Replies

7. UNIX for Dummies Questions & Answers

[Solved] How remove leading whitespace from xml (sed /awk?)

Hi again I have an xml file and want to remove the leading white space as it causes me issues later in my script I see sed is possible but cant seem to get it to work I tried sed 's/^ *//' file.xml output <xn:VsDataContainer id="1U104799" modifier="update"> ... (10 Replies)
Discussion started by: aniquebmx
10 Replies

8. Shell Programming and Scripting

Can't remove spaces with sed when calling it from sh -c

The following command works echo "some text with spaces" | sh -c 'sed -e 's/t//g''But this doesn't and should echo "some text with spaces" | sh -c 'sed -e 's/ //g''Any ideas? (3 Replies)
Discussion started by: Tribe
3 Replies

9. Shell Programming and Scripting

Remove leading and trailing spaces from a file

Hi, I am trying to remove leading and trailing spaces from a file using awk but somehow I have not been able to do it. Here is the data that I want to trim. 07/12/2017 15:55:00 |entinfdev |AD ping Time ms | .474| 1.41| .581|green |flat... (9 Replies)
Discussion started by: svajhala
9 Replies

10. Shell Programming and Scripting

Trying to remove leading spaces

OS : RHEL 6.7 Shell : bash I am trying to remove the leading the spaces in the below file $ cat pattern2.txt hello1 hello2 hello3 hello4 Expected output is shown below. $ cat pattern2.txt hello1 hello2 hello3 hello4 (2 Replies)
Discussion started by: John K
2 Replies
Devel::PatchPerl(3pm)					User Contributed Perl Documentation				     Devel::PatchPerl(3pm)

NAME
Devel::PatchPerl - Patch perl source a la Devel::PPPort's buildperl.pl VERSION
version 0.72 SYNOPSIS
use strict; use warnings; use Devel::PatchPerl; Devel::PatchPerl->patch_source( '5.6.1', '/path/to/untarred/perl/source/perl-5.6.1' ); DESCRIPTION
Devel::PatchPerl is a modularisation of the patching code contained in Devel::PPPort's "buildperl.pl". It does not build perls, it merely provides an interface to the source patching functionality. FUNCTION
"patch_source" Takes two parameters, a "perl" version and the path to unwrapped perl source for that version. It dies on any errors. If you don't supply a "perl" version, it will attempt to auto-determine the "perl" version from the specified path. If you don't supply the path to unwrapped perl source, it will assume the current working directory. PLUGIN SYSTEM
See Devel::PatchPerl::Plugin for details of Devel::PatchPerl's plugin system. CAVEAT
Devel::PatchPerl is intended only to facilitate the "building" of perls, not to facilitate the "testing" of perls. This means that it will not patch failing tests in the perl testsuite. SEE ALSO
Devel::PPPort Devel::PatchPerl::Plugin AUTHOR
Chris Williams <chris@bingosnet.co.uk> COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Chris Williams and Marcus Holland-Moritz. 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.14.2 2012-06-04 Devel::PatchPerl(3pm)
All times are GMT -4. The time now is 07:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy