![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| why put double square brackets in an if clause? | napolayan | UNIX for Dummies Questions & Answers | 5 | 11-16-2006 03:18 AM |
| usage of brackets for if | lakshmikanth | UNIX for Dummies Questions & Answers | 4 | 07-28-2006 09:03 AM |
| how do you use brackets ?? in a script. | moxxx68 | Shell Programming and Scripting | 3 | 09-27-2004 10:57 PM |
| square brackets | gilead29 | UNIX for Dummies Questions & Answers | 2 | 02-03-2004 11:29 AM |
| Angle brackets | PxT | Post Here to Contact Site Administrators and Moderators | 1 | 04-05-2001 06:06 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
The brackets can be removed like any other character but have to be escaped because they have a special meaning to sed: "\[" will tell sed to treat the left bracket just as that character and with now special meaning at all. (Btw. the same is true for any other character with a special meaning, or "metacharacter" as is the correct denomination of these characters, too. "\*" will be an asterisk and not the wildcard, etc.).
Therefore your sed script is Code:
sed 's/\[//g;s/\]//g' /path/to/file Code:
sed 's/[[]]//g' /path/to/file |
|
||||
|
Quote:
Code:
for i in $(ls /path/to/files*)
do
sed 's/\[//;s/\]//' $i
done
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|