Results 1 to 3 of 3
I have a variable zamik, which is concatenated from a and b
So it looks something like:
Code:
a="| "
b=" ".
"| | | ".
I'd like to cut ...
- 04-03-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 2
Bash - cut " " from end of variable
I have a variable zamik, which is concatenated from a and b
So it looks something like:
I'd like to cut last empty spaces, so it would look like:Code:a="| " b=" ". "| | | ".
I tried many things, like:Code:"| | |".
zamik=${zamik#*|}
zamik=${zamik%|*}
zamik=${zamik%%\x20}
zamik=${zamik%"|"}
but none works...
- 04-03-2011 #2Linux User
- Join Date
- Jan 2007
- Location
- cleveland
- Posts
- 452
have you tried "cut"?
cut -b -12 <text
supposing you want to retain 12 characters.the sun is new every day (heraclitus)
- 04-04-2011 #3Just Joined!
- Join Date
- Apr 2011
- Posts
- 2
I solved it using local variables (i was adding $a and $b in recursive calls).
I couldn't use cut because I didn'n know how many characters exactly I want to keep.
Thanks anyway.


Reply With Quote