Removing text

2015-05-18 Thread Richard Taubo
Hi! Trying to remove the literal text "%st" from the command line return value: 0.0%st as in: [$] printf "0.0%st" | perl -pe 's/\%st//' I have also tried: [$] printf "0.0%st" | perl -pe 's/\Q%st\E//' Neither works. Would be happy if someone had any input here! :-) Thanks! Richard Taubo --

Re: Removing text

2015-05-18 Thread Jing Yu
Hi Richard, When you printf "0.0%st” in the command line, it prints 0.0t And that is the string piped to perl. This is perhaps why you didn’t succeed. J -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.or

Re: Removing text

2015-05-18 Thread Shawn H Corey
On Mon, 18 May 2015 17:32:03 +0200 Richard Taubo wrote: > Hi! > > Trying to remove the literal text "%st" from the command line return > value: 0.0%st as in: > [$] printf "0.0%st" | perl -pe 's/\%st//' > > I have also tried: > > [$] printf "0.0%st" | perl -pe 's/\Q%st\E//' > > Neither works.

Re: Removing text

2015-05-18 Thread Richard Taubo
Hi, and thanks to Shawn H Corey, Jing Yu. I see that I have not been specific enough. (And sorry for the top posting). The full (bash) script with perl parts looks like this: [$] top_return=$(top -n1 | head -5) [$] io_return=$(printf "%s\n" "$top_return" | grep "^Cpu(s)") [$] io_all=$(printf "

Re: Removing text

2015-05-19 Thread Richard Taubo
Hi! > On 18 May 2015, at 18:27, Richard Taubo wrote: > > Hi, > > and thanks to Shawn H Corey, Jing Yu. > > I see that I have not been specific enough. > (And sorry for the top posting). > > The full (bash) script with perl parts looks like this: > [$] top_return=$(top -n1 | head -5) > [$] i

Re: Removing text

2015-05-19 Thread Brandon McCaig
1234567890Richard: On Mon, May 18, 2015 at 12:27 PM, Richard Taubo wrote: > Hi, Hello, > The full (bash) script with perl parts looks like this: > [$] top_return=$(top -n1 | head -5) > [$] io_return=$(printf "%s\n" "$top_return" | grep "^Cpu(s)") > [$] io_all=$(printf "%s" "$io_return" | awk '

Re: Removing text

2015-05-19 Thread Brandon McCaig
On Tue, May 19, 2015 at 1:10 PM, Brandon McCaig wrote: > 1234567890Richard: Sorry, that should have been just "Richard:". I will blame my flaky browser-based user interface. I should have switched to mutt to write that. Regards, -- Brandon McCaig Castopulence Software

Re[2]: Removing text

2015-05-19 Thread Артём Варнайский
Вторник, 19 мая 2015, 11:02 +02:00 от Richard Taubo : >Hi! > > >> On 18 May 2015, at 18:27, Richard Taubo < o...@bergersen.no > wrote: >> >> Hi, >> >> and thanks to Shawn H Corey, Jing Yu. >> >> I see that I have not been specific enough. >> (And sorry for the top posting). >> >> The full (

Re[2]: Removing text

2015-05-19 Thread Артём Варнайский
Вторник, 19 мая 2015, 11:02 +02:00 от Richard Taubo : >Hi! > > >> On 18 May 2015, at 18:27, Richard Taubo < o...@bergersen.no > wrote: >> >> Hi, >> >> and thanks to Shawn H Corey, Jing Yu. >> >> I see that I have not been specific enough. >> (And sorry for the top posting). >> >> The full (

Removing text to the end of the line.

2002-12-19 Thread David Buddrige
Hi all, I have a bunch of C++ source files that contain the string PCN: sometext where somtext is an arbitary sequence of characters. Whenever the text "PCN:" occurs, I want to remove it and everything else to the end of the line. To do this, I have written the following script: while(<>) {

Re: Removing text to the end of the line.

2002-12-19 Thread David Buddrige
Hi all, Once again - I figured it out... here is the updated script: while(<>) { my $current_line; $current_line = $_; $current_line =~ s/PCN:.*//g; print $current_line; } It worked after I took out the square brackets - although I am not sure why - since the square brackets *

Re: Removing text to the end of the line.

2002-12-19 Thread John W. Krahn
David Buddrige wrote: > > Hi all, Hello, > I have a bunch of C++ source files that contain the string > > PCN: sometext > > where somtext is an arbitary sequence of characters. > > Whenever the text "PCN:" occurs, I want to remove it and everything else > to the end of the line. > > To do th