- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: A simple shell question(about variable)!
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
Discussions
Forums
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
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
тАО08-23-2002 07:56 PM
тАО08-23-2002 07:56 PM
If get strings from an application. Sometimes it get "jack", sometimes it get "@jack", and also can get "@@ja@ck". The number and position of the character "@" is unsure.
But now all "@" is useless for me. So I want to truncate all "@" in the variable "ssuinfo".
How can I achieve it?
Thanks a lot!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2002 01:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2002 03:31 AM
тАО08-24-2002 03:31 AM
Re: A simple shell question(about variable)!
tr -d "@"
should do it.
See extract from man tr below:
===============================================
tr copies the standard input to the standard output with substitution
or deletion of selected characters. Input characters from string1 are
replaced with the corresponding characters in string2. If necessary,
string1 and string2 can be quoted to avoid pattern matching by the
shell.
tr recognizes the following command line options:
-A Translates on a byte-by-byte basis. When this flag
is specified tr does not support extended
characters.
-c Complements the set of characters in string1,
which is the set of all characters in the current
character set, as defined by the current setting
of LC_CTYPE, except for those actually specified
in the string1 argument. These characters are
placed in the array in ascending collation
sequence, as defined by the current setting of
LC_COLLATE.
-d Deletes all occurrences of input characters or
collating elements found in the array specified in
string1.
If -c and -d are both specified, all characters
except those specified by string1 are deleted. The
contents of string2 are ignored, unless -s is also
specified. Note, however, that the same string
cannot be used for both the -d and the -s flags;
when both flags are specified, both string1 (used
for deletion) and string2 (used for squeezing) are
required.
If -d is not specified, each input character or
collating element found in the array specified by
string1 is replaced by the character or collating
element in the same relative position specified by
string2.
-s Replaces any character specified in string1 that
occurs as a string of two or more repeating
characters as a single instance of the character
in string2.
If the string2 contains a character class, the
argument's array contains all of the characters in
that character class. For example:
In a case conversion, however, the string2 array
contains only those characters defined as the
second characters in each of the toupper or
tolower character pairs, as appropriate. For
example:
tr -s '[:upper:]' '[:lower:]'
===============================================
Hope this helps!
Best Regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2002 05:26 AM
тАО08-24-2002 05:26 AM
Re: A simple shell question(about variable)!
How do you get the string into "ssuinfo" ? Something like:
ssuinfo=`
Try:
ssuinfo=`
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-24-2002 12:06 PM
тАО08-24-2002 12:06 PM