- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Using a simple SED script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2003 08:12 AM
08-15-2003 08:12 AM
I have a file containing names of file I wish to link to a working directory.
I wish to insert ln ./path/path2/ in front of every line of text, and then execute the file to link the files in the list to my working directory.
How do I use a / in the field?
I have tried the following without succes:
sed "s/^/ln ./path1/path2//" file.tmp > file.lnk
Thanks for your help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2003 08:15 AM
08-15-2003 08:15 AM
Re: Using a simple SED script
example
echo abc | sed -e 's/^/\/tmp\//'
/tmp/abc
Rgds,
Jean-Luc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2003 08:19 AM
08-15-2003 08:19 AM
Re: Using a simple SED script
So all /'s will look like "\/".
HTH.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2003 08:22 AM
08-15-2003 08:22 AM
Re: Using a simple SED script
as a delimiter, the regular experession can be delimited by any character except a blank or a newline. thus if the pattern contained slashes, you could choose another character, such as an exclamation mark as the delimiter
sed 's!^!ln ./p1/p2/!'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2003 08:25 AM
08-15-2003 08:25 AM
SolutionOpen vi and execute the below
:%s:^:\./path/path2/:
You can try the same in sed also. Use a different seperator or escape with a backslash \ before the /.
Try this one
sed -e "s:^:ln \./path1/path2/:" file.tmp >file.lnk
HTH,
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-15-2003 09:32 AM
08-15-2003 09:32 AM
Re: Using a simple SED script
cat file | sed 's/^/^\/path1\/path2\//g' > links.txt
cat links.txt |
while read line
do
ln -s $line .
done