Sponsored Content
Top Forums Shell Programming and Scripting Filter non-alpha character with grep/regexp Post 302871729 by owwow14 on Wednesday 6th of November 2013 04:53:04 PM
Old 11-06-2013
Filter non-alpha character with grep/regexp

Hi all,
I am trying to filter out those lines that contain a "non-alpha" character.
An example of my input is the following:

Code:
zygnematales    grb
zygocactus    grb
zygocactus_truncatus    plt
zygodactyl_foot    prt
zygoma    prt
zygomatic    prt
zygomatic_arch    prt
zygomatic_bone    prt
zygomatic_process    prt


My desired output is the following:

Code:
zygnematales    grb
zygocactus    grb
zygoma    prt
zygomatic    prt

I have tried the following grep:

Code:
grep '^-' input

but it doesn't seem to work.
Any help?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

grep using regexp

I have 2 files called stuff-egress-filter and stuff-ingress filter. There are also files called something like stuff-egress-F/0 I want to match the first two... I tried (i realize there is no filename... I'm piping this from the ls command) grep stuff-*-filter Finds nothing. If I... (18 Replies)
Discussion started by: earnstaf
18 Replies

2. Shell Programming and Scripting

tcl: regexp matching special character

Hello Experts, Can someone help me here: I have a variable which contains a string with "". set var1 {a} set str1 {a is the element i want to match} Now "regexp $var1 $str1" does not work? ("regexp {a\} $str1" works, but var1 gets it's value automatically from another script) Is... (6 Replies)
Discussion started by: sumitgarg
6 Replies

3. Shell Programming and Scripting

Perl RegExp to remove last character from strings

I use SAS (a statistical software) and have to remove last character or the last 1/2 numbers that appear after characters from the string using Perl Regular Expression (which is recognized by SAS). Input: f183ii10 f183ii2 f182ii1 f182ii2 f183iim f22ii f22ii11 f22ii12 pmh4 pmhm Desired... (2 Replies)
Discussion started by: ospreyeagle
2 Replies

4. Shell Programming and Scripting

rename - change n'th character of regexp

Hi, I wonder if its possible to do the following task using rename (perl v5.8.8). I want to find filenames matching the specific pattern and then change chosen character of this pattern to a given character, e.g. do the following renaming: regexp: 'ab' -----> 'a0b' What's the simplest... (0 Replies)
Discussion started by: pms
0 Replies

5. UNIX for Dummies Questions & Answers

Doubt with regexp-meta character

Hi, I am learning reg exp a bit :) Meta char info: {n,m} Matches the preceding character at least n times but not more than m times, for example, 'ba{2,3}b' will find 'baab' and 'baaab' but NOT 'bab' or 'baaaab'. Values are enclosed in braces (curly brackets). Input file: 112 11112... (2 Replies)
Discussion started by: dragon.1431
2 Replies

6. Shell Programming and Scripting

help with grep regexp

My input file looks like this: 13154|X,the deer hunter 13154|Y,the good life 1316|,american idol 1316|,bowling 1316|,chuck etc... The X, Y, or any other character (besides a comma) after the pipe is a "Device Type". I want to strip out lines that do not have a device type. I have... (2 Replies)
Discussion started by: jwinsk
2 Replies

7. Shell Programming and Scripting

A help in regexp and grep

I have test string value , something like the one below str='KUAMRJIT|GHOSH' If I type echo $str | grep -o -e '\|+' it doesnt give me anything . But on the contrary echo $str | grep -o -e '|' display the only one pipe character(|) thats there in the string above . The way I understood Unix... (8 Replies)
Discussion started by: kumarjt
8 Replies

8. Shell Programming and Scripting

Regexp for string that might contain a given character

I'm probably just not thinking of the correct term to search for :-) But I want to match a pattern that might be 'ABC' or '1ABC' there might be three characters, or there might be four, but if there are four, the first has to be 1 (1 Reply)
Discussion started by: jnojr
1 Replies

9. UNIX for Dummies Questions & Answers

Grep : Filter/Move All The Lines Containing Not More Than One "X" Character Into A Text File

Hi All It's me again with another huge txt files. :confused: What I have: - I have 33 huge txt files in a folder. - I have thousands of line in this txt file which contain many the letter "x" in them. - Some of them have more than one "x" character in the line. What I want to achieve:... (8 Replies)
Discussion started by: Nexeu
8 Replies

10. UNIX for Beginners Questions & Answers

awk or sed to print the character from the previous line after the regexp match

Hi All, I need to print the characters in the previous line just before the regular expression match Please have a look at the input file as attached I need to match the regular expression ^ with the character of the previous like and also the pin numbers and the output file should be like... (6 Replies)
Discussion started by: kshitij
6 Replies
sccs-prt(1)							   User Commands						       sccs-prt(1)

NAME
sccs-prt, prt - display delta table information from an SCCS file SYNOPSIS
/usr/ccs/bin/prt [-abdefistu] [-cdate-time] [-rdate-time] [-ysid] s.filename... DESCRIPTION
prt prints selected portions of an SCCS file. By default, it prints the delta table (version log). If a directory name is used in place of the s.filename argument, the prt command applies to all s.files in that directory. Unreadable s.files produce an error; processing continues with the next file (if any). The use of `-' as the s.filename argument indicates that the names of files are to be read from the standard input, one s.file per line. OPTIONS
If any option other than -y, -c, or -r is supplied, the name of each file being processed (preceded by one NEWLINE and followed by two NEW- LINE characters) appears above its contents. If none of the -u, -f, -t, or -b options are used, -d is assumed. -s, -i are mutually exclusive, as are -c and -r. -a Display log entries for all deltas, including those marked as removed. -b Print the body of the s.file. -d Print delta table entries. This is the default. -e Everything. This option implies -d, -i, -u, -f, and -t. -f Print the flags of each named s.file. -i Print the serial numbers of included, excluded, and ignored deltas. -s Print only the first line of the delta table entries; that is, only up to the statistics. -t Print the descriptive text contained in the s.file. -u Print the user-names and/or numerical group IDs of users allowed to make deltas. -cdate-time Exclude delta table entries that are specified cutoff date and time. Each entry is printed as a single line, preceded by the name of the SCCS file. This format (also produced by -r , and -y) makes it easy to sort multiple delta tables in chronological order. When both -y and -c, or -y and -r are supplied, prt stops printing when the first of the two condi- tions is met. -rdate-time Exclude delta table entries that are newer than the specified cutoff date and time. -ysid Exclude delta table entries made prior to the SID specified. If no delta in the table has the specified SID, the entire table is printed. If no SID is specified, the most recent delta is printed. USAGE
Output Format The following format is used to print those portions of the s.file that are specified by the various options. o NEWLINE o Type of delta (D or R) o SPACE o SCCS delta ID (SID) o TAB o Date and time of creation in the form: yy/mm/dd hh/mm/ss o SPACE o Username the delta's creator o TAB o Serial number of the delta o SPACE o Predecessor delta's serial number o TAB o Line-by-line change statistics in the form: inserted/deleted/unchanged o NEWLINE o List of included deltas, followed by a NEWLINE (only if there were any such deltas and the -i options was used) o List of excluded deltas, followed by a NEWLINE (only if there were any such deltas and the -i options was used) o List of ignored deltas, followed by a NEWLINE (only if there were any such deltas and the -i options was used) o List of modification requests (MRs), followed by a NEWLINE (only if any MR numbers were supplied). o Lines of the delta commentary (if any), followed by a NEWLINE. EXAMPLES
Example 1: Examples of prt. The following command: example% /usr/ccs/bin/prt -y program.c produces a one-line display of the delta table entry for the most recent version: s.program.c: D 1.6 88/07/06 21:39:39 username 5 4 00159/00080/00636... ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWsprot | +-----------------------------+-----------------------------+ SEE ALSO
sccs(1), sccs-cdc(1), sccs-delta(1), sccs-get(1), sccs-help(1), sccs-prs(1), sccs-sact(1), sccs-sccsdiff(1), what(1), sccsfile(4), attributes(5) DIAGNOSTICS
Use the SCCS help command for explanations (see sccs-help(1)). SunOS 5.10 5 Oct 1990 sccs-prt(1)
All times are GMT -4. The time now is 08:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy