- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Help parsing file
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
03-24-2004 06:13 AM
03-24-2004 06:13 AM
aa/bb/cc/dd/ee|mm|nn|oo|pp|qq
Or this: aa/bb|mm|nn|oo|pp|qq
Or this: aa/bb/cc/dd|mm|nn|oo|pp|qq
The number of slashes in the first part of the record is variable. The number of pipes is known. I need to turn the last slash into a pipe. All other slashes need to be retained. How can I do this?
Regards,
Cathy
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:21 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:34 AM
03-24-2004 06:34 AM
Re: Help parsing file
Simple, elegant, and brilliant!!
Many thanks!
Cathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:34 AM
03-24-2004 06:34 AM
Re: Help parsing file
part2=$(basename "aa/bb/cc/dd/ee|mm|nn|oo|pp|qq")
echo "$part1|$part2"
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:35 AM
03-24-2004 06:35 AM
Re: Help parsing file
Regards,
Cathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:39 AM
03-24-2004 06:39 AM
Re: Help parsing file
while read LINE
do
OLDNAME=`echo $LINE`
MYPATH=$(dirname $OLDNAME)
MYFILE=$(basename $OLDNAME)
NEWNAME=$(echo "$MYPATH|$MYFILE")
echo $NEWNAME
done < input_file
Hai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:39 AM
03-24-2004 06:39 AM
Re: Help parsing file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:40 AM
03-24-2004 06:40 AM
Re: Help parsing file
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:49 AM
03-24-2004 06:49 AM
Re: Help parsing file
Regards,
Cathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:55 AM
03-24-2004 06:55 AM
Re: Help parsing file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:56 AM
03-24-2004 06:56 AM
Re: Help parsing file
For a couple (hundreds) of thousand this is unlikely to be a significant task.
Cheers,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 06:56 AM
03-24-2004 06:56 AM
Re: Help parsing file
Thanks to all!
Cathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 07:06 AM
03-24-2004 07:06 AM
Re: Help parsing file
while read
do
dirname
basename
done
does 2 context switches for each line
using sed or perl does one for the whole file
and
while read Line
do
start=${Line%/*}
last=${Line##*/}
print "$start|$last"
done
does none
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2004 08:10 AM
03-24-2004 08:10 AM
Re: Help parsing file
Thanks to you all.
Cathy