HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- cut command - specifying multiple delimiters
Operating System - HP-UX
1829735
Members
2059
Online
109992
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
04-12-2006 02:15 AM
04-12-2006 02:15 AM
Re: cut command - specifying multiple delimiters
Peter said
"if you like a solution using shell features only (I did this in ksh): "
Your script starts with "#!/bin/sh"
I suspect this is the problem with your latest post.
BTW did the "read VAR1" work okay in my suggestion. It is odd if it works in mine but not Harrys.
"if you like a solution using shell features only (I did this in ksh): "
Your script starts with "#!/bin/sh"
I suspect this is the problem with your latest post.
BTW did the "read VAR1" work okay in my suggestion. It is odd if it works in mine but not Harrys.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2006 03:17 AM
04-12-2006 03:17 AM
Re: cut command - specifying multiple delimiters
Hi Danny,
I just checked:
/bin/sh
a=b.c
echo ${a#*.}
results in 'c' - so the string operators work in the posix shell as well.
Nevertheless:
- Flag your script with
#!/usr/bin/ksh -xe
It will stop at rhe first error and trace the commands.
- check for unprintable characters (like ^M).
mfG Peter
I just checked:
/bin/sh
a=b.c
echo ${a#*.}
results in 'c' - so the string operators work in the posix shell as well.
Nevertheless:
- Flag your script with
#!/usr/bin/ksh -xe
It will stop at rhe first error and trace the commands.
- check for unprintable characters (like ^M).
mfG Peter
The Universe is a pretty big place,
it's bigger than anything anyone has ever dreamed of before.
So if it's just us, seems like an awful waste of space, right?
Jodie Foster in "Contact"
- Tags:
- unprintable chars
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2007 11:03 PM
01-15-2007 11:03 PM
Re: cut command - specifying multiple delimiters
Hi Danny,
I too don have good knowledge, anyway see this code..it'll work.
since i've used only the coloumn number don change the coloumn number with any space.
copy your line "A20051109.0215-0230_SubNetwork=ONRM_RootMo,SubNetwork=SNTDCAUJRNC002,MeContext=SNTDCAUJRNC002_statsfile.xml"
in a file say file1
then do chmod 777 file1
then open a file say solution1.txt and paste the below lines
one=`cat file1 | cut '-c1-9'`
echo "1)$one"
two=`cat file1 | cut '-c11-14'`
echo "2)$two"
three=`cat file1 | cut '-c16-19'`
echo "3)$three"
four=`cat file1 | cut '-c21-93'`
echo "4)$four"
five=`cat file1 | cut '-c95-103'`
echo "5)$five"
six=`cat file1 | cut '-c105-107'`
echo "6)$six"
save and quit
chmod 777 solution1.txt
do ./solution1.txt
it'll give the file in that format.
Also you can alter the code as you require
If you use sed, everything can be finished in one
line.
:)
Prasath
I too don have good knowledge, anyway see this code..it'll work.
since i've used only the coloumn number don change the coloumn number with any space.
copy your line "A20051109.0215-0230_SubNetwork=ONRM_RootMo,SubNetwork=SNTDCAUJRNC002,MeContext=SNTDCAUJRNC002_statsfile.xml"
in a file say file1
then do chmod 777 file1
then open a file say solution1.txt and paste the below lines
one=`cat file1 | cut '-c1-9'`
echo "1)$one"
two=`cat file1 | cut '-c11-14'`
echo "2)$two"
three=`cat file1 | cut '-c16-19'`
echo "3)$three"
four=`cat file1 | cut '-c21-93'`
echo "4)$four"
five=`cat file1 | cut '-c95-103'`
echo "5)$five"
six=`cat file1 | cut '-c105-107'`
echo "6)$six"
save and quit
chmod 777 solution1.txt
do ./solution1.txt
it'll give the file in that format.
Also you can alter the code as you require
If you use sed, everything can be finished in one
line.
:)
Prasath
- « Previous
-
- 1
- 2
- Next »
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP