Sponsored Content
Special Forums UNIX Desktop Questions & Answers grep a specific amount of occurrence Post 302667945 by boaz733 on Sunday 8th of July 2012 06:52:24 AM
Old 07-08-2012
Java grep a specific amount of occurrence

hey , i m trying to figure out how to do the following :

i got a text file the looks like so:

Code:
 
1031
1031
1031
1031
1031
1031
1031
1031
16500
16500
16500
16500
1031
1031
1031
1031
1031
16500
16500
16500

i want to grep a specific amount of a value , for example
grep of "16500" for 3 occurrences the output will be:

Code:
16500
16500
16500

note that this is a part of a table i dont want to just print the value - X times.

please advise
thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Grep for the same occurrence or maybe Sed

Hi, I have a file that looks like this dasdjasdjoasjdoasjdoa SYN dakspodkapsdka asdasdasdasdasdasdasd SYN sdfsdfsdfsdfdf shfishifhsdifhsidhfif fsdfsdfsdfsdfs sdfsdfsdfsdsdfsdfsdff cercercercerce sdasdajsdoajsodasodoo FIN dasdaskdpasdda... (4 Replies)
Discussion started by: hcclnoodles
4 Replies

2. UNIX for Dummies Questions & Answers

grep usage - exit after first occurrence

Hi, Is there any way of using grep (this may be done in awk, not sure?) that I can stop grep'n a file once I have found the first occurrence of my search string. Looking through grep man pages -q will exit without printing the lines after the first match, but I need the output. I have... (5 Replies)
Discussion started by: nhatch
5 Replies

3. UNIX for Dummies Questions & Answers

Line number of an occurrence using grep

Hi All, is there a way to extract the line number of an occurrence using grep? I know that with the -n option it prints out the line number as well. I would like to assign the line number to a variable. Thanks, Sarah (5 Replies)
Discussion started by: f_o_555
5 Replies

4. Shell Programming and Scripting

Generate specific amount of same characters

Hi, Is there a command to print one character x amont of times? I need for example 10 comma's (,,,,,,,,,,). Instead of creating a loop, I was wondering if there is a way to do this with sed or awk? Thanks! (3 Replies)
Discussion started by: Subbeh
3 Replies

5. UNIX for Dummies Questions & Answers

grep first occurrence but continue to next entry in patternfile

I have 1300 files (SearchFiles0001.txt, SearchFiles0002.txt, etc.) , each with 650,000 lines, tab-delimited data. I have a pattern file, with about 1000 lines with a single word. Each single word is found in the 1300 files once. If I grep -f PatternFile.txt SearchFiles*.txt >OutputFile.txt... (2 Replies)
Discussion started by: newhavendweeb
2 Replies

6. UNIX for Dummies Questions & Answers

Is it possible to grep a certain amount of characters?

I have a file similar to the following filler filler filler car 6 mazda filler filler filler filler car civic honda car rav 4 toyota filler filler If i do a "grep -i car file.txt" the output would be car 6 mazda car civic honda car rav 4 toyota however, i want to have the... (4 Replies)
Discussion started by: jl487
4 Replies

7. Shell Programming and Scripting

Shifting result of echo by specific amount

I am using echo "HELLO" I want to specify a number shiftWt so that I move hello forward by shiftWt charcaters. Is there a way to do this? (2 Replies)
Discussion started by: kristinu
2 Replies

8. Shell Programming and Scripting

Adding text to the end of the specific line in a file(only to the first occurrence of it)

Hi, I want to add a text to the end of the specific line in a file. Now my file looks like this: 999 111 222 333 111 444 I want to add the string " 555" to the end of the first line contaning 111. Moreover, I want to insert a newline after this line containg the "000" string. The... (8 Replies)
Discussion started by: wenclu
8 Replies

9. Shell Programming and Scripting

Run a command for specific amount of time with an auto key press

Hi, I have been trying to do a small fun project for myself. I want to run a command for 45 seconds. And to get the final output of this command, the script requires I push the "q" key on my keyboard and then the final output file becomes available. I tried the following script. But it... (12 Replies)
Discussion started by: jacobs.smith
12 Replies

10. Shell Programming and Scripting

Grep util last occurrence

I have file contents /tmp/x/abc.txt /home/bin/backup/sys/a.log I need this output: /tmp/x/ /home/bin/backup/sys/ Can somebody please help me out Please use CODE tags as required by forum rules! (3 Replies)
Discussion started by: jhonnyrip
3 Replies
PCCBB(4)						   BSD Kernel Interfaces Manual 						  PCCBB(4)

NAME
pccbb -- cardbus bridge driver SYNOPSIS
device cbb device pccard device cardbus device exca DESCRIPTION
The pccbb driver implements the Yenta specification for CardBus bridges. The following PCI cardbus and pcmcia bridges are supported: Cirrus Logic PD6832 Cirrus Logic PD6833 Cirrus Logic PD6834 O2micro OZ6812 O2micro OZ6832 O2micro OZ6833 O2micro OZ6836 O2micro OZ6860 O2micro OZ6872 O2micro OZ6912 O2micro OZ6922 O2micro OZ6933 O2micro OZ6972 O2Micro OZ711E1 O2Micro OZ711M1 Ricoh RL4C475 Ricoh RL4C476 Ricoh RL4C477 Ricoh RL4C478 TI PCI-1031 TI PCI-1130 TI PCI-1131 TI PCI-1210 TI PCI-1211 TI PCI-1220 TI PCI-1221 TI PCI-1225 TI PCI-1250 TI PCI-1251 TI PCI-1251B TI PCI-1260 TI PCI-1260B TI PCI-1410 TI PCI-1420 TI PCI-1450 TI PCI-1451 TI PCI-1510 TI PCI-1515 TI PCI-1520 TI PCI-1530 TI PCI-1620 TI PCI-4410 TI PCI-4450 TI PCI-4451 TI PCI-4510 TI PCI-4520 TI PCI-[67]x[12]1 TI PCI-[67]x20 ENE CB710 ENE CB720 ENE CB1211 ENE CB1255 ENE CB1410 ENE CB1420 Toshiba ToPIC95 Toshiba ToPIC95B Toshiba ToPIC97 Toshiba ToPIC100 TUNABLES
The driver supports the following tunable parameters, which may be added to /boot/loader.conf or set via the sysctl(8) command: hw.cbb.debug Non-zero values cause more verbose information to be printed to aid in debugging problems with the bridge chipset. SEE ALSO
cardbus(4), pccard(4), exca(4) BSD
July 21, 2004 BSD
All times are GMT -4. The time now is 11:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy