![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
maybe sed, maybe ex?
I have a file containing the following line:
dn: employeeNumber=xxxxxxx, c=us, ou=people, o=xxx.com After the first comma, there are 2 spaces, i want to get rid of them. After the 2nd and 3rd comma, there is one space, i want to get rid them also. All in all, i would like the line to look like this dn: employeeNumber=xxxxxxx,c=us,ou=people,o=xxx.com Any help is appreciated. Thanks. -S |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
editing the file in place:
Code:
perl -pi -e 's/, +/,/g' file |
|
#3
|
|||
|
|||
|
sed:
Code:
sed -i 's/, \{1,\}/,/g' file
|
|
#4
|
|||
|
|||
|
Code:
sed 's/, */,/g' filename |
|||
| Google The UNIX and Linux Forums |