Sponsored Content
Top Forums Shell Programming and Scripting remove non-alphabetic from a match line Post 302578161 by Skrynesaver on Thursday 1st of December 2011 03:04:06 AM
Old 12-01-2011
If I understand you correctly, the following should work
Code:
[skrynesaver@busybox ~]$ cat file
Some random data
Some random data
Some random data
Some random data
Some random data
Some random data
Some random data
Some random data
Some random data
Products from: [12]LG(21)
Some random data
Some random data
Some random data
Some random data
Some random data
Products from: [12]Motorola(21)
Some random data
Some random data
Some random data
Some random data
Some random data
Some random data
Some random data
Some random data
Some random data
Some random data
[skrynesaver@busybox ~]$ egrep '^Products from' file|sed s'/Products from\(.\+\)/\1/g'|sed 's/[^[:alpha:]]//g'
LG
Motorola
[skrynesaver@busybox ~]$

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

To convert the numeric month into alphabetic

hi , This function actually gives me the last month but as a numeric value what should i do to get it as suppose :Jul date '+%b %Y' | { read MONTH YEAR MONTH=`expr "$MONTH" - 1` echo $MONTH } Thanks. Rooh (2 Replies)
Discussion started by: rooh
2 Replies

2. Shell Programming and Scripting

Quick regex question about alphabetic string

Hi guys, Pretty new to regex, and i know im doing something wrong here. I'm trying to get a regex command that restricts a string to be 8 characters long, and the first character cannot be 0. Here's what i have so far... echo "01234" | grep "^{8}*$" Thanks very much! -Crawf ... (7 Replies)
Discussion started by: crawf
7 Replies

3. UNIX for Dummies Questions & Answers

sort file on timestamp and a alphabetic code in it

Hi, I have files like ER08EVENTDC080911232324.txt ER08EVENTCD080911232323.txt ER08EVENTCD080910222222.txt ER08EVENTCD080910130245.txt ER08EVENTAA080910130245.txt ER08EVENTAA080910232000.txt ER08EVENTAA080911015005.txt ER08EVENTAA080910130150.txt ER08EVENTAA080910232010.txt... (5 Replies)
Discussion started by: harshada
5 Replies

4. Shell Programming and Scripting

Delete line with match and previous line quoting/escaping problem

Hi folks, I've list of LDAP records in this format: cat cmmac.export.tmp2 dn: deviceId=0a92746a54tbmd34b05758900131136a506,ou=devices,ou=customer,ou=nl,o=upc cmmac: 00:13:11:36:a5:06 dn: deviceId=0a92746a62pbms4662299650015961cfa23,ou=devices,ou=customer,ou=nl,o=upc cmmac:... (4 Replies)
Discussion started by: tomas.polak
4 Replies

5. Shell Programming and Scripting

Remove line breaks after a match

I need to remove all line breaks in a document after a match, until there is a blank line. Example below, after the match "THE GREEN TABLE" remove line breaks until a blank line. Then, after the match "THE BLUE TABLE" do the same. Before: THE GREEN TABLE Lorem ipsum dolor sit amet,... (14 Replies)
Discussion started by: dockline
14 Replies

6. Shell Programming and Scripting

I need to know how to replace a line after a pattern match with an empty line using SED

Hi How Are you? I am doing fine! I need to go now? I will see you tomorrow! Basically I need to replace the entire line containing "doing" with a blank line: I need to the following output: Hi How Are you? I need to go now? I will see you tomorrow! Thanks in advance.... (1 Reply)
Discussion started by: sags007_99
1 Replies

7. Shell Programming and Scripting

Awk-sed help : to remove first and last line with pattern match:

awk , sed Experts, I want to remove first and last line after pattern match "vg" : I am trying : # sed '1d;$d' works fine , but where the last line is not having vg entry it is deleting one line of data. - So it should check for the pattern vg if present , then it should delete the line ,... (5 Replies)
Discussion started by: rveri
5 Replies

8. Homework & Coursework Questions

Function to Check if string input from user is alphabetic only

Good Evening. I'm new to C. Can you please help me. I'm creating an error checking function, user will input a string, this will check if the input is all alphabet or all letters only. If there is a digit or other special char, it will print Error then ask input from user again. Here's my... (1 Reply)
Discussion started by: eracav
1 Replies

9. Shell Programming and Scripting

Match pattern1 in file, match pattern2, substitute value1 in line

not getting anywhere with this an xml file contains multiple clients set up with same tags, different values. I need to parse the file for client foo, and change the value of tag "64bit" from false to true. cat clients.xml <Client type"FIX"> <ClientName>foo</ClientName>... (3 Replies)
Discussion started by: jack.bauer
3 Replies
L-DIALCODES(5)							File Formats Manual						    L-DIALCODES(5)

NAME
L-dialcodes - UUCP phone number index file DESCRIPTION
The L-dialcodes file defines the mapping of strings from the phone number field of L.sys(5) to actual phone numbers. Each line in L-dialcodes has the form: alpha_string phone_number The two items can be separated by any number of blanks or tabs. Lines beginning with a `#' character are comments. A phone number in L.sys can be preceded by an arbitrary alphabetic character string; the string is matched against the list of alpha_strings in L-dialcodes. If a match is found, phone_number is substituted for it. If no match is found, the string is discarded. L-dialcodes is commonly used either of two ways: (1) The alphabetic strings are used as prefixes to denote area codes, zones, and other commonly used sequences. For example, if L-dialcodes included the following lines: chi 1312 mv 1415 In L.sys you could enter: chivax Any ACU 1200 chi5551234 ogin:--ogin: nuucp mvpyr Any ACU 1200 mv5556001 ogin:--ogin: Uuucp instead of chivax Any ACU 1200 13125551234 ogin:--ogin: nuucp mvpyr Any ACU 1200 14155556001 ogin:--ogin: Uuucp (2) All phone numbers are placed in L-dialcodes, one for each remote site. L.sys then refers to these by name. For example, if L-dialcodes contains the following lines: chivax 13125551234 mvpyr 14155556601 then L.sys could have: chivax Any ACU 1200 chivax ogin:--ogin: nuucp mvpyr Any ACU 1200 mvpyr ogin:--ogin: Uuucp This scheme allows a site administrator to give users read access to the table of phone numbers, while still protecting the login/password sequences in L.sys. FILES
/etc/uucp/L-dialcodes /etc/uucp/UUAIDS/L-dialcodes L-dialcodes example SEE ALSO
uucp(1), uux(1), L.sys(5), uucico(8). 4.3 Berkeley Distribution October 22, 1996 L-DIALCODES(5)
All times are GMT -4. The time now is 05:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy