Hi all,
if for example I had a variable containing the string 'hello', is the any way I can output, for example, the e and the 2nd l based on their position in the string not their character (in this case 2 and 4)?
any general pointers in the right direction will be much appreciated, at... (3 Replies)
Hi Please help me to refine my syntax. I want to delete the excess characters from the out put below.
-bash-3.00$ top -b -n2 -d 00.20 |grep Cpu|tail -1 | awk -F ":" '{ print $2 }' | cut -d, -f1
4.4% us
now i want to delete the % and us. How wil i do that to make it just 4.4.
Thanks (7 Replies)
Hi,
I've a csv file seperated by '|' from which I'm trying to remove the excess '|' characters more than the existing fields. My CSV looks like as below.
HRLOAD|Service|AddChange|EN
PERSONID|STATUS|LASTNAME|FIRSTNAME|ITDCLIENTUSERID|ADDRESSLINE1
10000001|ACTIVE|Testazar1|Testore1|20041|||... (24 Replies)
sed -e "s// /g" old.txt > new.txt
While I do know some control characters need to be escaped, can normal characters also be escaped and still work the same way? Basically I do not know all control characters that have a special meaning, for example, ?, ., % have a meaning and have to be escaped... (11 Replies)
helloo
I wonder if there's a way to cut characters out of a string and keep only
the last 2 by using sed.
For example if there's the todays' date:
2012-05-06
and we only want to keep the last 2 characters which are the day.
Is there a quick way to do it with sed? (2 Replies)
Hey guys,
I know that title is a mouthful - I'll try to better explain my struggles a little better...
What I'm trying to do is:
1. Query a db and output to a file, a list of column data.
2. Then, for each line in this file, repeat these values but wrap them with:
ITEM{
... (3 Replies)
Hi,
I have a xml file (Config.xml)
<Header name="" TDate="" PDate="">
<Config>
{"config" { "Nation" "Pri:|Sec:"}}
</Config>
</Header>
Now I wanted to printed all the strings between "". I tried the following
cat Config.xml | sed -n 's/.*\.*//p'
... (8 Replies)
Hi,
I hope you can help me out please?
I need to replace from character 8-16 with AAAAAAAA and the rest should stay the same after character 16
gtwrhtrd11111111rjytwyejtyjejetjyetgeaEHT
wrehrhw22222222hytekutkyukrylryilruilrGEQTH
hrwjyety33333333gtrhwrjrgkreglqeriugn;RUGNEURGU
... (4 Replies)
I have a file that looks like this:
>ID 1
AATAATTCCGGATCGTGC
>ID 2
TTTGACAGTAGAC
>ID 3
AGACGATGACGAT
I am using the following script to report if AATTCCGGATCG is present in any sequence:
awk 'FNR==1{n=substr(FILENAME,1,index(FILENAME,".")-1)} { print n "\t"... (10 Replies)
Discussion started by: Xterra
10 Replies
LEARN ABOUT HPUX
basename
basename(1) General Commands Manual basename(1)NAME
basename, dirname - extract portions of path names
SYNOPSIS
string [suffix]
[string]
DESCRIPTION
deletes any prefix ending in and the suffix (if present in string) from string, and prints the result on the standard output. If string
consists entirely of slash characters, string is set to a single slash character. If there are any trailing slash characters in string,
they are removed. If the suffix operand is present but not identical to the characters remaining in string, but it is identical to a suf-
fix of the characters remaining in string, the suffix is removed from string. is normally used inside command substitution marks within
shell procedures.
delivers all but the last level of the path name in string. If string does not contain a directory component, returns indicating the cur-
rent working directory.
EXTERNAL INFLUENCES
Environment Variables
determines the interpretation of string and, in the case of basename, suffix as single and/or multi-byte characters.
If is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty vari-
able. If is not specified or is set to the empty string, a default of "C" (see lang(5)) is used instead of If any internationalization
variable contains an invalid setting, and behave as if all internationalization variables are set to "C". See environ(5).
International Code Set Support
Single- and multi-byte character code sets are supported.
EXAMPLES
The following shell script, invoked with the argument compiles the named file and moves the output to a file named in the current direc-
tory:
The following example sets the shell variable to
RETURN VALUE
and return one of the following values:
Successful completion.
Incorrect number of command-line arguments.
SEE ALSO expr(1), sh(1).
STANDARDS CONFORMANCE basename(1)