10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
Wish to remove "DR-" from the string variable (var).
var="DR-SERVER1"
var=`echo $var | sed -e 's/DR-//g'`
echo "$var"
Expected Output:
However, I get the below error:
Can you please suggest. (4 Replies)
Discussion started by: mohtashims
4 Replies
2. Shell Programming and Scripting
Hi All,
I'm facing issue wherein I have 2 character string like 'CR' and 'DR' and I want to extract just 1st character but am unable to do it. I tried below options but they are returning me 2nd character only,
var="CR"
echo ${var:1}
returns just "R"
echo ${var:0}
returns "CR"
... (5 Replies)
Discussion started by: arvindshukla81
5 Replies
3. UNIX for Dummies Questions & Answers
Hi,
My requirement is to get the substring and then remove special character.
Ex
I have data like T_SYSTEM_XXXXX_YYYY_ZZZ
I want to get XXXXXYYYYZZZ
the part after T_SYSTEM is varying it might be XXX_YY or just XX
can you tell me which all commands i have to use.
i understand i... (5 Replies)
Discussion started by: Mohammed_Tabish
5 Replies
4. UNIX for Dummies Questions & Answers
Hi Dears,
How to use variable in string location of expression ${string:index:length} to get substring from string?
I encounter error "bad substitution" when I use expression ${$var:0:5} to get first 5 characters from $var.
Could you please help me out of this? Thanks! (2 Replies)
Discussion started by: crest.boy
2 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I hav a string lets say aa.txt:bb:txt
length of the string can vary.. I have to keep the token inside a array and the delimiter is : plz send me the code (2 Replies)
Discussion started by: Deekay.p
2 Replies
6. Shell Programming and Scripting
I have a string '<Hi>abc</Hi>"
How to print "abc" (6 Replies)
Discussion started by: sandy1028
6 Replies
7. UNIX for Dummies Questions & Answers
I need to check the occurrence of one string within another.
code
********************
if ;then do something done
********************
Thanks (7 Replies)
Discussion started by: w020637
7 Replies
8. UNIX for Dummies Questions & Answers
I am trying something like below. But unfortunately i am missing sthg here.
$ HOSTEXT=hostname | awk '{print substr ($0,7)}'
$ echo $HOSTEXT
$
Suggestioins/Solutions will very much be appreciated.
Thanks in advance,
best-dyno. (2 Replies)
Discussion started by: best-dyno
2 Replies
9. Shell Programming and Scripting
Dear All,
i have a file that contains,
FROM_DATE: 06-08-2007 00:00:00 TO_DATE: 06-08-2007 23:59:59 Total number of lines: 6874154
in another file,the contain is,
FROM_DATE: 06-08-2007 00:00:00 Total number of lines: 874154
alltime i want to find the particular string... (4 Replies)
Discussion started by: panknil
4 Replies
10. Shell Programming and Scripting
Hello everyone.
I'm writing a script in UNIX. The purpose is to get the second character from a variable that stores the system year.
This is the code:
unix_year_yy=`date "+%g"`
This will return "07" in variable unix_year_yy. How can I get the second character (7)?? (6 Replies)
Discussion started by: Rigger
6 Replies