- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How can i add an space at the end of the word ...?
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
04-07-2007 07:44 AM
04-07-2007 07:44 AM
v=hi
i want that v="hi " i mean a space at the end of the word ... how can i do that?
i tried
V=`echo $v `
but it did not work .. :(
thanks..
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2007 08:03 AM
04-07-2007 08:03 AM
SolutionUse formatted printing:
# v="hi"
# printf "%-s \n" $v | cat -etv
...and you will see the space before the neline ($).
p.s. I added some more commentary to your thread here:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=1115881
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2007 08:05 AM
04-07-2007 08:05 AM
Re: How can i add an space at the end of the word ...?
Those double quotes!
You gotta know when to hold them, when to fold them!
$ v=hi
$ vv=$v" "
$ vvv="hi "
$ echo "==$v==$vv==$vvv=="
==hi==hi ==hi ==
free advice...
bracket variable names to allow arbitrary strings to be glues to them
$ x="${v}test"
Hein.
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2007 08:17 AM
04-07-2007 08:17 AM
Re: How can i add an space at the end of the word ...?
IT WORKED ...
$ printf "%-s \n" $v | cat -etv
hi $
$ V=`printf "%-s \n" $v | cat -etv`
$ echo $V
hi $
$ echo $V | sed 's/\$//g'
hi
$ echo $V | sed 's/\$//g' | wc -w
1
$ echo $V | sed 's/\$//g' | wc -s
wc: illegal option -- s
usage: wc [-c|-m] [-lw] [name ...]
$ echo $V | sed 's/\$//g' | wc -c
4
Thanks a lot !!!! :)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2007 08:23 AM
04-07-2007 08:23 AM
Re: How can i add an space at the end of the word ...?
i have other doubt ..
$ m=`echo $Z | sed 's/\$//g'`
$ echo $m
hi $
$
why can i not to replace $ by nothing? when i'm using sed command ..
please let me know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-07-2007 08:25 AM
04-07-2007 08:25 AM
Re: How can i add an space at the end of the word ...?
i already understood ..
i have only to use the following ...
printf "%-s \n" $v
thanks !!!!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-09-2007 11:59 PM
04-09-2007 11:59 PM
Re: How can i add an space at the end of the word ...?
From the subject line I was excited to witness a phylosophical dispute about infinity, eternity and beyond here.