10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Greetings.
I'm looking to isolate the first occurrence of an arbitrary substring which may be present at any particular line in a given file. The enclosing end markers for the target in our thought problem are string" and ". The complete string and surrounding text could look something like... (3 Replies)
Discussion started by: LinQ
3 Replies
2. UNIX for Dummies Questions & Answers
I am trying to obtain a substring in AIX, but unable to obtain result
${var:1:3}
ksh: ${var:1:3}: bad substitution (3 Replies)
Discussion started by: tostay2003
3 Replies
3. UNIX for Advanced & Expert Users
Hi All,
I need some help with an awk command:
What I'm trying to do is append "MYGROUP: " to text with the substring "AT_"
the input file follows this format:
AT_xxxxxx
Name1
Name2
AT_xxxxxx
NameA
NameB
I want the output to be:
MYGROUP: AT_xxxxx
Name1
Name2
MYGROUP:... (2 Replies)
Discussion started by: bikecraft
2 Replies
4. Shell Programming and Scripting
Hi
I have a table like this
I want to know how many times the string in 2nd column appears in the first column as substring.
For example the first string of 2nd column "cgt" occurs 3 times in the 1st column and "acg" one time.
So my desired output is
THank you very much in advance:) (14 Replies)
Discussion started by: polsum
14 Replies
5. Shell Programming and Scripting
Hi Team,
How to get the last 3 characters of a String irrespective of their length using awk?
Thanks
Kinny (5 Replies)
Discussion started by: kinny
5 Replies
6. Shell Programming and Scripting
Hi,
i have a file from which i extracted 2nd column and put it into a variable Acct_Num . Now i need to extract first 3 digits from it and save in to other variable.
My Code is:
while read Record1
do
Acct_Num=`echo $Record1 | awk '{print $2 }'`
ID=`echo $Record1 | awk '{print... (3 Replies)
Discussion started by: manmeet
3 Replies
7. Shell Programming and Scripting
I have a file which comes with a few tags and some contents inside them.
eg:
<ABC>Hello Unix.com</ABC>
<XYZ>WWSHF</XYZ>
Now I want to pick out the contents in between the tags <ABC> and </ABC>.
The contents within <ABC> and </ABC> spans more than one line. So greping and cutting is not an... (4 Replies)
Discussion started by: Rajat
4 Replies
8. UNIX for Dummies Questions & Answers
hi all, I have read similiar topics in this board, but i didn' t find the posting which is the same with the problem i face.. I try to extract string from the end. i try to do this:
num=abcdefghij
num2=${num:-5}
echo $num2 #this should print the last 5 characters (fghij)
but it doesn;t... (3 Replies)
Discussion started by: nashrul
3 Replies
9. UNIX for Dummies Questions & Answers
can we do substring fuctionality using AWK
say I have string "sandeep"
can i pick up only portion "nde" from it.
Thanks and Regards
Sandeep Ranade (3 Replies)
Discussion started by: mahabunta
3 Replies
10. UNIX for Dummies Questions & Answers
I am trying to get various portions of strings in my script, but am getting a substitution error. I followed the syntax that was described when I goggled this, but I can't get anything to work.
#! /bin/ksh/
hello="adklafk;afak"
#hello=${hello:3}
hello=${$hello:3}
happy="hey"
echo... (1 Reply)
Discussion started by: anderssl
1 Replies