- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- cut in a 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
07-30-2002 02:23 PM
07-30-2002 02:23 PM
cut in a script
I am trying to write a script that gives me a swlist, and other
things, I am trying to cut out
some "tabs" How do I cut out tabs
using the cut command???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2002 02:30 PM
07-30-2002 02:30 PM
Re: cut in a script
swlist | awk '/^ /{print $1 ":" $2 ":" $3}'
This will replace the tabs with ":".
Hope this helps.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2002 03:12 PM
07-30-2002 03:12 PM
Re: cut in a script
swlist | cut -d"Ctrl-vCtrli" -f2
Ctrl-v and Ctrl-i should put a tab in "cut" as a seperator.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2002 04:18 PM
07-30-2002 04:18 PM
Re: cut in a script
I just tried:
swlist|cut -f1
this gave me just col. 1.
Looked in 'cut' man pages - tab delimiter is the default, so i figure no need to actually specify it, when used with -f.
see ya.
Maria
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 12:59 AM
07-31-2002 12:59 AM
Re: cut in a script
tr '\011' ' ' | tr -s " "
Or you could simply change successive tabs into one tab with tr -s "\011"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 01:13 AM
07-31-2002 01:13 AM
Re: cut in a script
Sometimes its difficult using awk to differentiate between the colums beacuse of the difference in the amounts of tabs, spaces etc. You can use the folowing:
swlist -l product -a size -a install_date -a description | while read SIZE DATE DESC
do
...
done
This way you can seperate the different columns, just have description as the last column.
HtH,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2002 01:22 AM
07-31-2002 01:22 AM
Re: cut in a script
cut -f1 works on tabs, so - as Maria already said - should just give what you need.
If you have `expand'ed your tabs, you can switch to
cut -c1-9 to get the first nine characters of each line (or -c16-55 for columns 16 though 55, see man cut), including the white space
cut also accepts a -d option to specify the delimiter
cut -d\