grep problem with the ^ symbol, help needed please.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers grep problem with the ^ symbol, help needed please.
# 1  
Old 03-31-2008
grep problem with the ^ symbol, help needed please.

Hello I am new to this forum and have been perplexed by this issue for the last hour of my life, I've tried to search everywhere for a solution to my syntax error, but here is my code.

grep -wvnf 'noise.dat' sample.out | sort

output:
4:Java Swing
5:Swing Java
6:Software Requirements Analysis
7:Requirements Analysis Software
8:Analysis Software Requirements

my desired ouput should be

1 Analysis Software Requirements
2 Filters Pipes and
3 Java Swing
4 Pipes and Filters
5 Requirements Analysis Software
6 Software Requirements Analysis
7 Swing Java

with the line "and Filters Pipes" omitted.

I have tried doing grep -wvnf '^noise.dat' sample.out | sort

with the ^ symbol in there but i get the "grep: ^noise.dat: No such file or directory" with so many different variations, but I just cannot figure it out.

Any help would be greatly appreciated, I have spent so much time on this, and yes I do know I am noob, but my professor for this class is horrible.
# 2  
Old 03-31-2008
Quote:
Originally Posted by Gvsumrb
Hello I am new to this forum and have been perplexed by this issue for the last hour of my life, I've tried to search everywhere for a solution to my syntax error, but here is my code.

grep -wvnf 'noise.dat' sample.out | sort

output:
4:Java Swing
5:Swing Java
6:Software Requirements Analysis
7:Requirements Analysis Software
8:Analysis Software Requirements

my desired ouput should be

1 Analysis Software Requirements
2 Filters Pipes and
3 Java Swing
4 Pipes and Filters
5 Requirements Analysis Software
6 Software Requirements Analysis
7 Swing Java

with the line "and Filters Pipes" omitted.

I have tried doing grep -wvnf '^noise.dat' sample.out | sort

with the ^ symbol in there but i get the "grep: ^noise.dat: No such file or directory" with so many different variations, but I just cannot figure it out.

Any help would be greatly appreciated, I have spent so much time on this, and yes I do know I am noob, but my professor for this class is horrible.
It is against the rules of the forum to post homework questions. I shall try only to guide you in the right direction. No direct solutions.

What are the contents of sample.out and noise.dat ? Also "^" is used when you are using a string and not when using an input file.
# 3  
Old 03-31-2008
this is most definitely not the homework question, only 1 line of code in a larger script that basically uses circular shifting to move the first word to the end of the string repeatedly and later on post the results.


noise.dat is a file created that contains

the
a
an
and
or

sample.out contains (created by the script i wrote)

Analysis Software Requirements
and Filters Pipes
Filters Pipes and
Java Swing
Pipes and Filters
Requirements Analysis Software
Software Requirements Analysis
Swing Java

I didn't realize that ^ cannot be used with an input file, and is only associated with strings, Ill keep going at it. I guess Ill add some kind of if statement in my script to just get rid of any strings that begin with any of the "noise.dat" contents, since grep is being elusive.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to grep � symbol?

Hello, I have multiple text files and I need to know which of them are having character issues. Below command is not working. Maybe instead of that weird string, I should replace it with ascii code. grep -A0 "�" file.txt Thank you Boris (10 Replies)
Discussion started by: baris35
10 Replies

2. UNIX for Advanced & Expert Users

Grep - Explanation needed.

grep -E '^(++){5}5000' <file_name> this command searches value 5000 in only 6th column from provided file where pipe ( | )is delimiter which separate columns... can some one plz explain me what '^(++){5}5000' actually does..? :confused: (1 Reply)
Discussion started by: Killer420
1 Replies

3. UNIX for Dummies Questions & Answers

grep line for string up to symbol

Hi, I would like to extract a pattern from a line. The first two characters will always be the same in this pattern, but the proceeding numbers will not be, and the pattern will always be 6 characters long. I would like to get the entire pattern up to a certain symbol, in this case, a period. ... (3 Replies)
Discussion started by: goodbenito
3 Replies

4. UNIX for Dummies Questions & Answers

Grep output help needed

According to linux hardening guide a PATH variable must not contain . or .. so i grep the path variable using. # echo $PATH | grep "." /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin # echo $PATH | grep ".."... (2 Replies)
Discussion started by: pinga123
2 Replies

5. UNIX for Dummies Questions & Answers

Help Needed with Grep

Hi all, I need some urgent help with grep. I'm simply trying to extract the current date from the syslog file, which is "Oct 6" and then grepping this and output the messages to a new log file. See the below commands and output, even though the log file is created, it is created with all the... (8 Replies)
Discussion started by: wthomas
8 Replies

6. Solaris

/usr/lib/passwdutil.so.1: symbol __nsl_fgetspent_r: referenced symbol not found

deleteing post (0 Replies)
Discussion started by: dshakey
0 Replies

7. Shell Programming and Scripting

Problem while concating PIPE symbol with a file

Hi Gurus, I had a problem writing a pipe file. Previously i used this code to generate a tab seperated file ABCEF := ABCEF || 'to_char('|| abc_tab(col_num).col_name || ') chr(9) || '; Now i want the o/p as pipe seperated file.I changed the line as below ABCEF := ABCEF ||... (0 Replies)
Discussion started by: pssandeep
0 Replies

8. HP-UX

Unresolved symbol problem

Hi I am trying to make an executable which has informix esqlc and .per files. I am using informix version 9.3. The make is successful, but when i execute, i get an error message /usr/lib/dld.sl: Unresolved symbol: ibm_lib4gl_loadint4 (code) from RVprnrecvr Abort(coredump) I searched for... (4 Replies)
Discussion started by: venkatakrishnan
4 Replies

9. UNIX for Dummies Questions & Answers

Help with tail /grep needed

Hello: I'm a very newbee at UNIX/AIX. What i want to do is to tail a file from the bottom until a certain string is found and write all the lines after the found string to another file. I've tried out a lot of combination with tail and grep but doesn't find the good one. Could someone help... (4 Replies)
Discussion started by: Felix2511
4 Replies

10. Programming

fread64 fwrite64 compilation problem (undefined symbol)

I use a standard C source to access large files in a 32 bit environment. I've replaced fopen, fwrite and fread by fopen64, fwrite64 and fread64. First I did a test only replacing fopen by fopen64, it compiled without any other changes to my compilation options. The program crashed on a write, as... (3 Replies)
Discussion started by: Isax50
3 Replies
Login or Register to Ask a Question