LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Closed Thread
  Search this Thread
Old 03-18-2005, 11:53 AM   #1
tifu
LQ Newbie
 
Registered: Mar 2005
Location: markham, ontario
Posts: 6

Rep: Reputation: 0
question on sed


I have a file (file01) with several words that I need to output to another file (file02). I need file02 to be formated to a single column, will all non-alphabet characters removed, except for dash (-) and appostrophe (') characters.

When I use the following, it formats correcly and removes all non-alphabet characters (including ' and -)

tr ' ' '\n' <$FILEDIR/file01 | sed -e 's/[^a-z A-Z]//;/^$/ d' >$FILEDIR/file02


When I try to specify the exclusion of ' and - characters as in below, the command fails. What am I doing wrong?

tr ' ' '\n' <$FILEDIR/file01 | sed -e 's/[^a-z A-Z]//;s/[']//; s/[\-];/^$/ d' >$FILEDIR/file02

Thanks

Omar
 
Old 03-18-2005, 02:14 PM   #2
stickman
Senior Member
 
Registered: Sep 2002
Location: Nashville, TN
Posts: 1,552

Rep: Reputation: 53
Try escaping the ' in ['] with a backslash.
 
Old 03-18-2005, 02:27 PM   #3
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 377Reputation: 377Reputation: 377Reputation: 377
i believe the issue has been resolved in this thread's twin:

http://www.linuxquestions.org/questi...hreadid=303194
 
Old 03-18-2005, 05:38 PM   #4
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,580

Rep: Reputation: 191Reputation: 191
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php

The problem is solved in the Programming forum: http://www.linuxquestions.org/questi...hreadid=303194 and this thread is closed.
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
sed question ckoniecny Linux - General 3 11-11-2005 10:31 AM
sed question sphynx Programming 6 04-28-2004 07:25 PM
little sed question freelinuxcpp Linux - Software 3 01-20-2004 08:36 AM
sed question zoomzoom Linux - Software 2 10-20-2003 05:04 PM
A question on 'sed' Barbarian Programming 4 04-11-2002 11:19 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:33 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration