Results 1 to 2 of 2
Hi,
I have a lots of mailq in postfix. I want to create a script but the return of mailq is below:
83BE81A1872*
8797A1A1998*
8C45A1A1A72*
865D71A1A45*
845CC1A1A46*
86B7E1A1C09*
Is there ...
- 07-18-2007 #1Linux Newbie
- Join Date
- Mar 2006
- Posts
- 101
How could I exempt char to grep?
Hi,
I have a lots of mailq in postfix. I want to create a script but the return of mailq is below:
83BE81A1872*
8797A1A1998*
8C45A1A1A72*
865D71A1A45*
845CC1A1A46*
86B7E1A1C09*
Is there a way in grep where I can remove the (*) so that I can delete the file manually?
- 07-18-2007 #2
grep is simply a matcher. You want an editor. Fortunately, in your particular case, Bash has this built in:
${var%substring} notation means "Take the variable $var, and remove the shortest substring that matches my substring from the end".Code:line="test*" echo "${line%\*}"
In your particular case, just be careful with the '*', because this is a special character in Bash. Make sure you quote it.DISTRO=Arch
Registered Linux User #388732


Reply With Quote