Command filtering ONLY rows NOT beginning with '*'


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Command filtering ONLY rows NOT beginning with '*'
# 1  
Old 08-10-2009
Command filtering ONLY rows NOT beginning with '*'

I need a command which filters rows ONLY NOT beginning with '*'

So far I have following NOT sufficient command, because it does not include ALL possible literals except of '*'

Code:
 
grep ^[a-zA-Z0-9' '] INPUT_FILE >>OUTPUT_FILE

Is it possible to write something like

Code:
 
grep NOT ^[*] INPUT_FILE >>OUTPUT_FILE

Thanks

---------- Post updated at 07:54 AM ---------- Previous update was at 07:53 AM ----------

Note: it is bash-shell
# 2  
Old 08-10-2009
Code:
grep -v ^[*] INPUT_FILE >>OUTPUT_FILE

# 3  
Old 08-10-2009
Code:
grep -v \^\* INPUT_FILE >>OUTPUT_FILE

# 4  
Old 08-10-2009
Simple rule of shell programming: if you want to match a shell special character like wildcards, escape/quote them:
Code:
grep -v '^*' INPUT_FILE >> OUTPUT_FILE
grep -v ^\* INPUT_FILE >> OUTPUT_FILE

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Filtering netstat command output

Hi All, I am trying to collect the listen ports info from netstat command in centos 7 From that info i am trying to collect all the foreign address IP for those ports. I am using below script to do the same. netstat -an |grep -w "LISTEN" |grep -v "127.0.0.1" |awk '{print $4}' >... (3 Replies)
Discussion started by: sravani25
3 Replies

2. Shell Programming and Scripting

Egrep -v command not filtering correctly

Hello guys, I have an issue when trying to do an egrep -v on a file, let me show you. I want to filter the last column as to where it filters out the columns with asterisks and zeros ( * and 0 ) it is working properly up to a certain point where I have a value of '10000' which is also getting... (3 Replies)
Discussion started by: evergreen
3 Replies

3. Shell Programming and Scripting

Read command restarts at beginning of file

I am reading in a file in a Korn shell script. The file has one header row followed by possibly millions of data rows. I want to do one thing to the header row and write it out to a new output file, then something different to the data rows. My code looks like this: read header < $infile ... (4 Replies)
Discussion started by: DJR
4 Replies

4. Shell Programming and Scripting

Filtering out rows

# powermt display dev=all .... snipped ... Pseudo name=hdiskpower8 Symmetrix ID=000192602584 Logical device ID=059F state=alive; policy=SymmOpt; priority=0; queued-IOs=0 ============================================================================== ---------------- Host --------------- ... (7 Replies)
Discussion started by: Daniel Gate
7 Replies

5. Shell Programming and Scripting

filtering the rows in a file

hi all, please help on this isssue, i have a file which contains something like this and i want to seprate the servers which has vasd.pid ,i need only server names. i want output something like this which vasd.pid . server1 server3 server4 (4 Replies)
Discussion started by: sudharson
4 Replies

6. Shell Programming and Scripting

Remove comma and next rows beginning from the end

Hello friends, I have a file which consists of many rows, I use a couple of commands to convert it so i can use in a database query for filtering. I need the first columns (msisdns) in a row, seperated with commas, 9855162267,4,5,2010-11-03 17:02:07.627 9594567938f,5,5,2010-11-02... (9 Replies)
Discussion started by: EAGL€
9 Replies

7. Shell Programming and Scripting

Filtering rows for first two instances of a value

Kindly help me with this problem: My data looks like this: SNPfile.txt CHR_A BP_A SNP_A CHR_B BP_B SNP_B R2 p-SNP_A p-SNP_B 4 172575323 rs17056855 4 172601079 rs11945883 0.119414 0.049972656 0.031050345 4 172575323 rs17056855 4 ... (2 Replies)
Discussion started by: genehunter
2 Replies

8. Shell Programming and Scripting

Command to remove numbers from beginning of txt file

Hello. I have the following issue: my txt file has the following format: train/dr4/fklc0/sx175.txt 0 80282 Severe myopia contributed to Ron's inferiority complex. train/dr4/fklc0/sx355.txt 0 42906 Dolphins are intelligent marine mammals. train/dr4/fklc0/sa2.txt With the... (1 Reply)
Discussion started by: li_bi
1 Replies

9. Shell Programming and Scripting

How to fetch rows based on line numbers or based on the beginning of a word?

I have a file which will have rows like shown below, ST*820*316054716 RMR*IV*11333331009*PO*40.31 REF*IV*22234441009*xsss471-2762 DTM*003*091016 ENT*000006 RMR*IV*2222234444*PO*239.91 REF*IV*1234445451009*LJhjlkhkj471-2762 </SPAN> DTM*003* 091016 RMR*IV*2223344441009*PO*40.31... (18 Replies)
Discussion started by: Muthuraj K
18 Replies

10. UNIX for Dummies Questions & Answers

filtering with find command...

dear all, i have a rather simple question that I cannot seem to find an answer to.. i have a directory with 8 base directories and 30 something subdirectories.. in each subdirectory I have aloccated base files (empty files) that I can refer to from find.. these base files will then have three or... (7 Replies)
Discussion started by: moxxx68
7 Replies
Login or Register to Ask a Question