![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| remove trailing and leading spaces using tr command | sureshg_sampat | Shell Programming and Scripting | 5 | 03-04-2009 05:04 AM |
| Removing leading and trailing spaces of data between the tags in xml. | jhmr7 | UNIX for Dummies Questions & Answers | 2 | 05-18-2005 11:27 AM |
| Strip leading and trailing spaces only in a shell variable with embedded spaces | jerardfjay | Shell Programming and Scripting | 6 | 03-07-2005 02:24 PM |
| Leading and Trailing Spaces | sleepster | Shell Programming and Scripting | 7 | 10-29-2003 11:48 PM |
| removing trailing spaces of a particular column in a file | rooh | UNIX for Dummies Questions & Answers | 2 | 01-12-2002 11:34 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Removing leading and trailing spaces only in PERL
Hi All,
I have a file with the following contents with multiple lines Code:
172445957| 000005911|8| 400 Peninsula Ave.#1551 | And,K |935172445957|000005911 607573888 |000098536 | 2|Ane, B |J |Ane |1868 |19861206|20090106|20071001 For example: I want to remove leading space from " 000005911" and leading and trailing spaces from " 400 Peninsula Ave.#1551 " within the | delimter, not in between spaces of 400 and Peninsula and Ave. I tried the following code Code:
$data =~ s/^\s/+/; $data =~ s/\s+$//; from " 400 Peninsula Ave.#1551 " to "400PeninsulaAve.#1551" But I want like "400 Peninsula Ave.#1551" no leading and trailing spaces I just the put quotes for explanation. Please help me if I can do it perl. Appreciate your help. Regards -Kumar Last edited by Yogesh Sawant; 04-04-2009 at 04:39 PM.. Reason: added code tags |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|