10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
How can I extract digits at the end of a string in UNIX shell scripting or perl?
cat file.txt
abc_d123_4567.txt
A246_B789.txt
B123cc099.txt
a123_B234-012.txt
a13.txt
What can I do here? Many thanks.
cat file.txt | sed "s/.txt$//" | ........
4567
789
099
012
13 (11 Replies)
Discussion started by: mingch
11 Replies
2. Shell Programming and Scripting
In the bash below the user selects the file to be used. The digits of each file are unique and used to automatically locate the next file to be used in the process. The problem I can not seem to fix is that the full path needs to be referenced in the second portion and it is not currently. Is... (7 Replies)
Discussion started by: cmccabe
7 Replies
3. Shell Programming and Scripting
In the below portion of a bash script the user selects a file from a directory.
select file in $(cd /home/cmccabe/Desktop/NGS/API/5-14-2016/bedtools;ls);do break;done
files in directory
123_base_counts.txt
456_base_counts.txt
789_base_counts.txt
second portion of bash currently (user... (4 Replies)
Discussion started by: cmccabe
4 Replies
4. UNIX for Dummies Questions & Answers
Hello again people,
I have a list of websites in this format:
domain.com
domain1.com
domain2.com
domainwww.com
domain2www.com
domain3www.com
www.domain.com
www.domain2.com
www.domain3.com
I want to replace the string "www." with "nothing" but only lines that start with "www."
... (3 Replies)
Discussion started by: galford
3 Replies
5. UNIX for Dummies Questions & Answers
I'm trying to grep lines where the digits at the end of each line are greater than digits. Tried this but it will only allow me to specify 2 digits. Any ideas would greatly be appreciated. grep -i '\<\{3,4,5\}\>' file
---------- Post updated at 05:58 PM ---------- Previous update was at 05:41... (1 Reply)
Discussion started by: jimmyf
1 Replies
6. Shell Programming and Scripting
I have the following code and want to get only the comments.
Ideally I would like to replace the characters to the left of the first '!' in the line with blanks.
real, dimension(:), allocatable :: ft ! stores a single trace
real, dimension(:), allocatable :: tr ! stores a single... (8 Replies)
Discussion started by: kristinu
8 Replies
7. Shell Programming and Scripting
Hi there, im sure this is really simple but i have some strings like this
e1000g123001
e1000g0
nge11101
nge3and i want to create two variables ($DRIVER and $INSTANCE). the first one containing the alpha characters that make up the first part of the string, e.g. e1000g or nge and the... (9 Replies)
Discussion started by: rethink
9 Replies
8. Shell Programming and Scripting
Hi Experts,
Here is what I am trying to do.
1) say I have a file with below strings
database1
database2
database3
data10gdb1
data10gdb2
databasewithoutdigit
2) I want to get the below output.
(- if there is any digit at the end of the string, I need to remove it)
(- Any... (3 Replies)
Discussion started by: shail_boy
3 Replies
9. Shell Programming and Scripting
How to replace null with space?
I want to make each line with 80 characters. If any line contains only 5 characters and remaining is null, then i want to make it as 80 characrets where 5 is original characters and remaining 75 characters will be null..
NULL can come in between the line,... (3 Replies)
Discussion started by: Amit.Sagpariya
3 Replies
10. Shell Programming and Scripting
I have a string like xxxxxx44. What's the best way to extract the digits (one or more) in a ksh script?
Thanks (6 Replies)
Discussion started by: offirc
6 Replies