I'm trying to read in a particular part of a string, using substr... and I want to pipe it to grep or sed in order to remove all trailing or ending spaces... so if I have this string:
$string = "a abc d";
$newstring = substr($string,1,4)
$newstring would equal = " abc"... but I want it to equal "abc"
I'm doing this to many different lines of code, so is there a way to pipe it or do it in the same line, I don't want to have to do $string = s/\s+//g; for every line. Just not familiar enough with piping and one-line expressions.
$string = "a abc d";
$newstring = substr($string,1,4)
$newstring would equal = " abc"... but I want it to equal "abc"
I'm doing this to many different lines of code, so is there a way to pipe it or do it in the same line, I don't want to have to do $string = s/\s+//g; for every line. Just not familiar enough with piping and one-line expressions.