Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to grep a number from output line Post 302373994 by daPeach on Monday 23rd of November 2009 05:31:52 AM
Old 11-23-2009
for example
Code:
echo "CFR 235,BBC DM-2 ALL
CFR 111,BBC DM-2 ALL
CFR 333,BBC DM-2 ALL" | grep -Eo "[0-9]{3}" | sort -g
111
235
333

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

is there any why to get the number of line in grep result ?

Hello all when I do simple grep on file im getting the results of "filename : stringResult " is there any way to present also the line number in the file ? (1 Reply)
Discussion started by: umen
1 Replies

2. UNIX for Dummies Questions & Answers

Get Filename and Line Number using grep

Hi, I am using the Korne shell to try and get the filename, line number and the line of text using grep e.g. find ./ -type f -name "*.java" -exec grep -nf test.txt '{}' \; (test.txt contains strings to search) will return the line number and the line of text. grep -l would return the... (4 Replies)
Discussion started by: ceemh3
4 Replies

3. Shell Programming and Scripting

grep the string with the line number

Dear Masters, Here i have some doubts can anyone clarify?. Is it possible to grep the lines by specifying the line numbers. I know the line number which i want to grep. example: grep 40th line filename grep 50th line filename Need ur comments. (4 Replies)
Discussion started by: salaathi
4 Replies

4. UNIX for Dummies Questions & Answers

How to grep / zgrep to output ONLY the matching filename and line number?

Hi all, I am trying to zgrep / grep list of files so that it displays only the matching filename:line number and does not display the whole line, like: (echo "1.txt";echo "2.txt") | xargs zgrep -no STRING If I use -o option, it displays the matching STRING and if not used, displays the... (3 Replies)
Discussion started by: vvaidyan
3 Replies

5. Shell Programming and Scripting

Using grep to extract line number

I'm trying to use grep to get the line number only. This is the command I'm using: grep -n "Content-Disposition: attachment" mbox The output I get is: 45:Content-Disposition: attachment; filename="test.txt" So now I just want to get the line number (45) from this output. Can someone... (8 Replies)
Discussion started by: mskarica
8 Replies

6. UNIX for Dummies Questions & Answers

Grep or other ways to output line above and/or below searched line

Hi all, Would like to know how I could search for a string 'xyz' but have the output show the line plus the line above and/or below all lines found. eg. search for xyz from file containing: abc 12345 asdf xyz asdfds wwwww kjkjkj ppppp kkkxyz eeee zzzzz and the output to... (2 Replies)
Discussion started by: sammac
2 Replies

7. UNIX for Dummies Questions & Answers

Grep SQL output file for greater than number.

Hi, This is my first post. I have a korn shell script which outputs a select statment to a file. There is only one column and one row which contains a record count of the select statement. The select statement looks something like this: SELECT COUNT(some_field) AS "count_value" ... (2 Replies)
Discussion started by: MurdocUK
2 Replies

8. Shell Programming and Scripting

sed command to replace a line in a file using line number from the output of a pipe.

Sed command to replace a line in a file using line number from the output of a pipe. Is it possible to replace a whole line piped from someother command into a file at paritcular line... here is some basic execution flow.. the line number is 412 lineNo=412 Now i have a line... (1 Reply)
Discussion started by: vivek d r
1 Replies

9. UNIX for Beginners Questions & Answers

How do I use grep to grab prime number output from my factor program?

I have a factor program that runs and outputs to stdout all the prime numbers that are specified in the given paramters, in this case 30000000-31000000. Command: factor/factor 30000000-31000000 Sample output: 30999979 = 30999979 30999980 = 2^2 5 11 140909 30999981 = 3 10333327... (6 Replies)
Discussion started by: steezuschrist96
6 Replies

10. UNIX for Beginners Questions & Answers

How to output non-number lines with grep?

I want to check my data quality. I want to output the lines with non-number. I used the grep command: grep '' myfile.csv Since my file is csv file, I don't want to output the lines with comma. And I also don't want to output "." or space. But I still get the lines like the following:... (8 Replies)
Discussion started by: twotwo
8 Replies
bbc_beep(7D)							      Devices							      bbc_beep(7D)

NAME
bbc_beep - Platform-dependent Beep driver for BBC-based hardware. SYNOPSIS
beep@unit-address DESCRIPTION
The bbc_beep driver generates beeps on platforms (including Sun Blade 1000) that use BBC-based registers and USB keyboards. When the KIOC- CMD ioctl is issued to the USB keyboard module (see usbkbm(7M)) with command KBD_CMD_BELL/KBD_CMD_NOBELL, usbkbm(7M) passes the request to the bbc_beep driver to turn the beep on and off, respectively. FILES
/platform/sun4u/kernel/drv/sparcv9/bbc_beep 64-bit ELF kernel driver ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Architecture |BBC-based SPARC | +-----------------------------+-----------------------------+ |Availability |SUNWcarx.u | +-----------------------------+-----------------------------+ SEE ALSO
kbd(1), attributes(5), grbeep(7d), kb(7M), usbkbm(7M) Writing Device Drivers DIAGNOSTICS
None SunOS 5.11 18 Dec 2001 bbc_beep(7D)
All times are GMT -4. The time now is 06:22 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy