add numbered bulletpoints to grep output


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers add numbered bulletpoints to grep output
# 1  
Old 08-04-2007
add numbered bulletpoints to grep output

I would like to add "word -esque" numbered bulletpoints to the output of a grep search, which has multiple hits for the search term

i.e. grep x filename

1) abcd x
2) efgh x
3) ijkl x

I dont have a clue to how to start writing such a script, i cant use SED or AWK so i was maybe thinking of using a loop ... would i be right?

any help at all would be gratefully appreciated.Smilie

thanks soooo much in advance
# 2  
Old 08-04-2007
Why can't you use awk? It would be trivial.
# 3  
Old 08-04-2007
Judging by this and other posts, becasue it is homework. Thread closed.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to grep the desired output and output to a file?

currently I have process from a raw file to this stage ALTER TABLE "EXCEL_ADMIN"."TC_TXN_VOID" ADD CONSTRAINT "PK_TC_TXN_VOID" PRIMARY KEY ("TC_TXN_IID") ALTER TABLE "EXCEL_ADMIN"."TC_TXN_AMT" ADD CONSTRAINT "PK_TC_TXN_AMT" PRIMARY KEY ("TC_TXN_AMT_IID") ALTER TABLE... (10 Replies)
Discussion started by: jediwannabe
10 Replies

2. Shell Programming and Scripting

renaming numbered files

Hi there, I've got a set of files that are named as follows: image_N1_8letters.jpg image_N2_8letters.jpg ... image_N10_8letters.jpg image_N11_8letters.jpg .... image_N100_8letters.jpg image_N101_8letters.jpg with the "8letters" bit always consisting of 8 but always different... (3 Replies)
Discussion started by: kjartan
3 Replies

3. Shell Programming and Scripting

rename numbered files to numbered files with leading zeroes

Hi, I have some hundreds/thousands of files named logX.dat, where X can be any integer, and they are sequential, X ranges between 1 and any number: log1.dat log2.dat log3.dat log6.dat log10.dat ... log6000.dat I would like to rename them to scatter_params_0001.dat... (6 Replies)
Discussion started by: pau
6 Replies

4. UNIX for Dummies Questions & Answers

join files with numbered index

Hi all I´m a newbie so maybe this question will make someone mad. I am trying this command; join -a1 -11 file1 file2 > file3 file1 looks like: 1 2 3 4 5 6 7 8 9 10 11 file2: (4 Replies)
Discussion started by: awe1
4 Replies

5. Shell Programming and Scripting

perl - how to make output of a command a numbered list

Hi there, just wondered if somebody could help me with a problem I have I have a program that when run from the command line will output a list of objects # list_servers server1 server5 server7 server8 # I just wanted to know, in perl, how can i make each line of output from... (4 Replies)
Discussion started by: rethink
4 Replies

6. Shell Programming and Scripting

Listing even numbered files

Hi All, Could you please help in this case? Case: there's a directory 'CKMDB' in this directory, there are 30 files named in this manner 1.txt 2.txt 3.txt .... 30.txt Could you please guide me how to list only even numbered files like 2.txt... (5 Replies)
Discussion started by: xsam
5 Replies

7. UNIX for Dummies Questions & Answers

Append file with grep output but add timestamp?

I've setup a cron job that greps a file every five minutes and then writes (appends) the grep output/result to another file: grep "monkey" zoo.log | tail -1 >> cron-zoo-log Is there any way I can add the date and time (timestamp) to the cron-zoo-log file for each time a new line was added? ... (12 Replies)
Discussion started by: Sepia
12 Replies

8. Shell Programming and Scripting

loop through numbered filenames

Hi I'm very new to this script thing, so please be gentle. I am trying to get a command - the mach2qtl command in the code below - to loop through a set of files. Each command should take the same two .dat and .ped files, but the .mlinfo and .mlprob files with filenames including 'chrom1' ... (7 Replies)
Discussion started by: polly_falconer
7 Replies

9. UNIX for Dummies Questions & Answers

Setting numbered variables

Normally I would post in the shell scripting area, but this is so basic I thought I'd best put it in the dummy area! I want to set a series of numbered variables. I have a loop which increments a variable called $i with each loop. I want to name variables with this number e.g. var1, var2, var3... (1 Reply)
Discussion started by: michaeltravisuk
1 Replies
Login or Register to Ask a Question