in reply to Re^4: how to remove a string from end of a line
in thread how to remove a string from end of a line
I cant write 22 pipes like "\|.*\|.*".
Why not? ;-)
But try this:
I used your original example data and only removed four instances, not 22 (because there weren't that many), but you get the idea.c:\@Work\Perl\monks>perl -wMstrict -le "my $s = 'RcdA|CON|139|||Kan|13|J|J|607|abc@gmail.com'; print qq{'$s'}; ;; $s =~ s{ (?: [|] [^|]*){4} \z }{}xms; print qq{'$s'}; " 'RcdA|CON|139|||Kan|13|J|J|607|abc@gmail.com' 'RcdA|CON|139|||Kan|13'
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: how to remove a string from end of a line
by ravi45722 (Pilgrim) on Oct 12, 2015 at 06:08 UTC | |
by AnomalousMonk (Archbishop) on Oct 12, 2015 at 06:53 UTC | |
by ravi45722 (Pilgrim) on Oct 12, 2015 at 11:53 UTC | |
by choroba (Cardinal) on Oct 12, 2015 at 12:23 UTC | |
by AnomalousMonk (Archbishop) on Oct 12, 2015 at 19:37 UTC | |
by ravi45722 (Pilgrim) on Oct 13, 2015 at 05:15 UTC |