10-19-2010
matching 3 digits at the begining and the end of the line
I have a file with hundreds of records and I need to find those records that have three digits at the beginning and the same three digits at the end.
$GREP '\([a-z]\)\([a-z]\)\([a-z]\)\3\2\1'I
believe this is part of the script but I am not sure how to compare these 3 digits with the 3 digits at the end of the same line. Any help is appreciated. Thank you.
10 More Discussions You Might Find Interesting
1. 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
2. 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
3. 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
4. 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
5. 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
6. 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
7. 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
8. 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
9. 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
10. 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
LEARN ABOUT OSF1
atmhosts
atmhosts(4) Kernel Interfaces Manual atmhosts(4)
NAME
atmhosts - ATM host name file
DESCRIPTION
The atmhosts file is an ASCII file that contains an single-line entry for each host on the ATM network. Each entry consists of an ATM
host address, official host name, and any aliases.
Parameters are separated by spaces or tab characters. A number sign (#) indicates the beginning of a comment; characters up to the end of
the line are not interpreted by routines that search the file.
ATM host addresses are specified by an even number of hexadecimal digits. Each pair of digits represents 8 bits of address information.
An ATM address can be one of the following: An ATM End System Address (AESA) as registered with the network (19 bytes, or 38 hexadecimal
digits) A local Endpoint System Identifier (ESI) that is registered with the local switch (6 bytes, or 12 hexadecimal digits) An AESA with
selector byte, representing the address of a service on a remote machine (20 bytes, or 40 hexadecimal digits).
Note
By default, the atmhosts file contains an entry for Permanent Virtual Circuits (PVCs). The entry consists of an ATM address of 40 hexadeci-
mal zeros (0) and the host name PVC. Do not change or delete this entry.
FILES
ATM hosts file
RELATED INFORMATION
Commands: atmconfig(8), atmarp(8) delim off
atmhosts(4)