LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-20-2019, 09:18 AM   #1
rbees
Member
 
Registered: Mar 2004
Location: northern michigan usa
Distribution: Debian Squeeze, Whezzy, Jessie
Posts: 921

Rep: Reputation: 46
A sed bug ? or just me ?


I am trying to remove most punctuation, but not all from a series of text files. The files are in Hebrew, I assume that means that they are Unicode, and are right justified.

There are curly braces around several specific Hebrew letters that indicate a specific amount of "white space" or a new line in the text. I don't want them removed but I do want the rest of the modern day punctuation removed.

This code should work but does not
Code:
w3m -dump -T text/html http://www.mechon-mamre.org/i/t/t0215.htm | sed '1,12d' | head -n -11 | sed -e "s/-/ /g; s/{/A/g; s/}/B/; s/[[:punct:]]//g; s/A/{/g; s/B/}/g" >  ~/tmp/k0215.txt
As can be seen the final { on the first line is in place but the subsequent lines have lost it. Testing has revealed that is it the "s/}/B;" that is failing. It is interesting to note that the order of the curly braces is reversed in the file, as it is actually the left curly brace that is missing.

Or am I missing something?
 
Old 01-20-2019, 09:52 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
I do not really understand, but looks like a g is missing here:
Code:
sed -e "s/-/ /g; s/{/A/g; s/}/B/g; s/[[:punct:]]//g; s/A/{/g; s/B/}/g"
 
1 members found this post helpful.
Old 01-20-2019, 11:05 AM   #3
rbees
Member
 
Registered: Mar 2004
Location: northern michigan usa
Distribution: Debian Squeeze, Whezzy, Jessie
Posts: 921

Original Poster
Rep: Reputation: 46
Thanks pan64

Somehow I missed that. All better now.
 
  


Reply



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
LXer: 2008 CES: Bug Labs Introduces BUG, BUGbase. So Cool! LXer Syndicated Linux News 0 01-09-2008 01:21 AM
2038 bug-Is Debian Bug-Proof? deepclutch Debian 1 08-02-2007 10:59 AM
Firefox bug? Fedora 7 bug? or what? hawke Fedora 8 07-22-2007 07:00 PM
BUG: soft lockup detected on CPU#0 and BUG: spinlock recursion on CPU#0 ... BloodyCat Linux - Hardware 3 11-07-2006 01:14 PM
Free86 bug or nVidia bug?? ProtoformX Linux - Software 2 05-12-2004 02:38 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 08:50 PM.

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
Open Source Consulting | Domain Registration