![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Processes by User's actual names | kartikkumar84@g | Shell Programming and Scripting | 1 | 05-22-2008 08:52 AM |
| Processes by Actual names | kartikkumar84@g | UNIX for Dummies Questions & Answers | 2 | 05-13-2008 03:03 PM |
| actual filesystem size during backup | shorty | UNIX for Dummies Questions & Answers | 1 | 02-20-2008 03:05 PM |
| Need actual bootpd for solaris | johnnypark | SUN Solaris | 0 | 04-28-2005 07:51 AM |
| Actual Memory Usage | gelbvonn | UNIX for Dummies Questions & Answers | 5 | 05-11-2004 07:13 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
How can I match . (actual dot) using sed?
Hi All,
How can I match . (actual dot) using sed? Please help. Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
You need to escape it with a \
Look at this. Code:
sh-2.05b$ cat jing.txt test . test.match Code:
sh-2.05b$ sed -n -e '/\./p' jing.txt . test.match |
|
#3
|
|||
|
|||
|
Thanks vino.
But this doesn't work. I am looking for /./* (one or more of /./ and replace with a single /./ I tried dereferencing . and / it doen't work. Please help. Thanks |
|
#4
|
||||
|
||||
|
This is going to be a confusing regex.
Code:
sed -e 's#\/\.\/\{1,\}#\/\.\/#g'
|
|
#5
|
|||
|
|||
|
Please see below:
cat 1 gives: /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ sed -e 's#\.\{1,\}#\.#g' 1 > 2 now see cat 2 /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ It is not working. |
|
#6
|
||||
|
||||
|
Yes the previous solution will not work.
But this should work Code:
sh-2.05b$ cat jing.txt test /./ test/.//.//./match sh-2.05b$ sed -e 's#\(\/\.\/\)*#\1#g' jing.txt test /./ test/./match |
|
#7
|
|||
|
|||
|
cat 1
/.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ sed -e 's#\(\/\.\/\)*#\1#g' 1 > 2 cat 2 /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ /.//.//./ It is not working. Is there is special reason why this doesn't work? |
|||
| Google The UNIX and Linux Forums |