- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- to change a list of name (character or digits) fro...
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
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
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
11-16-2015 01:51 PM
11-16-2015 01:51 PM
to change a list of name (character or digits) from vertical to horizontal : Korn Shell
I have a list of characters, and wanted to list them in horizontal format from vertical
for instance:
0c.07 -----> 0c.07 0a.12 ...
0a.12
...
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2015 02:47 PM
11-16-2015 02:47 PM
Re: to change a list of name (character or digits) from vertical to horizontal : Korn Shell
> I have a list of characters, [...]
Where "have" means what, exactly? Separated by what, exactly? One
space character? Any number of white-space characters? Other?
> and wanted to list them in horizontal format from vertical
If "list them" means print one word per line to stdout, then one
might use "tr" to translate a space to a new-line. For example (shown
here on a Mac):
pro3$ echo '0c.07 0a.12 0d.99' | tr ' ' '\n'
0c.07
0a.12
0d.99
As usual, many things are possible, and details may matter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-16-2015 06:38 PM - edited 11-17-2015 08:31 AM
11-16-2015 06:38 PM - edited 11-17-2015 08:31 AM
Re: to change a list of name (character or digits) from vertical to horizontal : Korn Shell
As Steven mentioned, there is too little information here.
Is your list coming out of a program in stdout?
Or is the list in a file?
Is the one output line constrained to a maximum length?
The simplest method is to assign all the lines of numbers to a variable like this:
MYLIST=$(someProgramName -options params)
or
MYLIST=$(cat SomeFileName) ...or... MYLIST=$(< SomeFileName)
Then echo the variable:
echo $MYLIST
This will list all the numbers on one long line.
If you do this:
echo "$MYLIST"
then you will get the original one-number-per-line.
This will handle thousands of numbers on one line -- which may not be what you want.
If you want the lines up to a certain length, then continued onto another line, use adjust like this:
echo $MYLIST | adjust -m 20
where -m 20 will start a new line at column 20 but not splitting any of the numbers at the end.
Bill Hassell, sysadmin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2015 11:23 PM
11-29-2015 11:23 PM
Re: to change a list of name (character or digits) from vertical to horizontal : Korn Shell
If you want to limit the number of words per line, you can use "xargs -L number".