10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am using the following sed script to remove new lines (\r\n and \n), except from lines starting with >:
sed -i ':a /^>/!N;s/\r\n\(\)/\1/;s/\n\(\)/\1/;ta'
Is there a way to include both \r\n and \n in one regex to avoid the second substitute script (s/\n\(\)/\1/)? (4 Replies)
Discussion started by: Xterra
4 Replies
2. Shell Programming and Scripting
Hi
Input:
aa-bb-cc-dd.ee.ff.gg
Output:
dd
I want to get the word after the last '-' until the first dot
I have tried with regex lookbehind and lookahead like this:
(?<=-).*(?=\.)
but his returns too much
bb-cc-dd.ee.ff (7 Replies)
Discussion started by: chitech
7 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. UNIX for Dummies Questions & Answers
Howdy Folks,
I have a list that looks like this:
(file2.txt)
AAA
BBB
CCC
DDD
and there are 24 of these short words.
I am matching these patterns to another file with 755795 lines (file1.txt).
I have this code for matching:
awk -v f2=file2.txt '
BEGIN {
while(... (2 Replies)
Discussion started by: heecha
2 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I am reading a file with millions of lines in it. Each line is big line containing several xml tags. I need to Output just the value of two tags in a seperate flat file.
For eg- I need to output whats present in <ComponentName> something </ComponentName> and another tag is... (2 Replies)
Discussion started by: sunnybehl
2 Replies
7. 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
8. Shell Programming and Scripting
I am trying to get a substring from a string stored in a variable. I tried sed with a bit help from this forum, but not successful. Here is my problem.
My string is: "REPLYFILE=myfile.txt"
And I need: myfile.txt (everything after the = symbol).
My string is: "myfile.txt.gz.20091120.enc... (5 Replies)
Discussion started by: jamjam10k
5 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. Shell Programming and Scripting
Ok, I'm stumped and can't seem to find relevant info.
(I'm not even sure, I might have asked something similar before.):
I'm trying to use shell scripting/UNIX commands to extract URLs from a fairly large web page, with a view to ultimately wrapping this in PHP with exec() and including the... (2 Replies)
Discussion started by: ropers
2 Replies