The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Unresolved symbol problem venkatakrishnan HP-UX 4 01-25-2008 02:39 AM
Problem with NFS & rpc.lockd-Help Needed theologic AIX 1 09-21-2007 01:36 AM
Help Needed in Grep Command ranga27 UNIX for Advanced & Expert Users 7 09-11-2007 09:20 AM
Help with tail /grep needed Felix2511 UNIX for Dummies Questions & Answers 4 05-17-2007 03:22 PM
fread64 fwrite64 compilation problem (undefined symbol) Isax50 High Level Programming 3 08-16-2005 03:26 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-31-2008
Gvsumrb Gvsumrb is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 2
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 (permalink)  
Old 03-31-2008
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,796
Quote:
Originally Posted by Gvsumrb View Post
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 (permalink)  
Old 03-31-2008
Gvsumrb Gvsumrb is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 2
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.
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:09 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0