Discussion:
Need a little help with Linux sed please.
George R Goffe grgoffe@yahoo.com [sed-users]
2018-09-19 03:15:13 UTC
Permalink
Hi,

I have a sed script that has been working for some time (I think). Now I'm getting a message:


cat showimages | sed -e "***@.*show=@@"

The file consists of some lines with garbage in front of a string "showimages". The script is intended to delete all the characters up to and including the string "showimages".

The message I get is:

sed: -e expression #1, char 10: unknown option to `s'


Is char #1 the "@" character? "my" sed doesn't like the @@ any more? The intent is to delete the match including "showimages".

Best regards,

George...
'Dave Van Handel' djvh2@comcast.net [sed-users]
2018-09-20 00:05:01 UTC
Permalink
-----Original Message-----
From: sed-***@yahoogroups.com [mailto:sed-***@yahoogroups.com]
Sent: Wednesday, September 19, 2018 4:38 PM
To: sed-***@yahoogroups.com
Subject: Re: Need a little help with Linux sed please.
Aside; the useless cat. You know every such line can be written?
Post by George R Goffe ***@yahoo.com [sed-users]
The file consists of some lines with garbage in front of a string
"showimages". The script is intended to delete all the characters up to and
including the string "showimages".


Does the garbage in front of showimages ever contain the @ sign?



---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
grgoffe@yahoo.com [sed-users]
2018-09-20 14:04:33 UTC
Permalink
Dave,

As it turns out, my sed script had several sed invocations... I took apart the complete line and found the error in on of the later sed commands. Sigh.

Yes, a UFU.

Thanks for your help,

George...



[Non-text portions of this message have been removed]

Carlos carlos_juvenal@yahoo.com [sed-users]
2018-09-20 08:43:49 UTC
Permalink
 sed '***@.*showimages@@'<showimages


Carlos Delgado
Sent from Yahoo Mail on Android
Aside; the useless cat. You know every such line can be written?
Post by George R Goffe ***@yahoo.com [sed-users]
The file consists of some lines with garbage in front of a string "showimages". The script is intended to delete all the characters up to and including the string "showimages".
sed: -e expression #1, char 10: unknown option to `s'
intent is to delete the match including "showimages".
Maybe you've got an extra "@"? Is the command above a direct cut/paste from
your script?

I tend to use the BEL character (^g) for my general "not in text" delimiter..
But that should be irrelevant to your problem.

Cheers,
Cameron Simpson <***@cskk.id.au>

#yiv5734109322 #yiv5734109322 -- #yiv5734109322ygrp-mkp {border:1px solid #d8d8d8;font-family:Arial;margin:10px 0;padding:0 10px;}#yiv5734109322 #yiv5734109322ygrp-mkp hr {border:1px solid #d8d8d8;}#yiv5734109322 #yiv5734109322ygrp-mkp #yiv5734109322hd {color:#628c2a;font-size:85%;font-weight:700;line-height:122%;margin:10px 0;}#yiv5734109322 #yiv5734109322ygrp-mkp #yiv5734109322ads {margin-bottom:10px;}#yiv5734109322 #yiv5734109322ygrp-mkp .yiv5734109322ad {padding:0 0;}#yiv5734109322 #yiv5734109322ygrp-mkp .yiv5734109322ad p {margin:0;}#yiv5734109322 #yiv5734109322ygrp-mkp .yiv5734109322ad a {color:#0000ff;text-decoration:none;}#yiv5734109322 #yiv5734109322ygrp-sponsor #yiv5734109322ygrp-lc {font-family:Arial;}#yiv5734109322 #yiv5734109322ygrp-sponsor #yiv5734109322ygrp-lc #yiv5734109322hd {margin:10px 0px;font-weight:700;font-size:78%;line-height:122%;}#yiv5734109322 #yiv5734109322ygrp-sponsor #yiv5734109322ygrp-lc .yiv5734109322ad {margin-bottom:10px;padding:0 0;}#yiv5734109322 #yiv5734109322actions {font-family:Verdana;font-size:11px;padding:10px 0;}#yiv5734109322 #yiv5734109322activity {background-color:#e0ecee;float:left;font-family:Verdana;font-size:10px;padding:10px;}#yiv5734109322 #yiv5734109322activity span {font-weight:700;}#yiv5734109322 #yiv5734109322activity span:first-child {text-transform:uppercase;}#yiv5734109322 #yiv5734109322activity span a {color:#5085b6;text-decoration:none;}#yiv5734109322 #yiv5734109322activity span span {color:#ff7900;}#yiv5734109322 #yiv5734109322activity span .yiv5734109322underline {text-decoration:underline;}#yiv5734109322 .yiv5734109322attach {clear:both;display:table;font-family:Arial;font-size:12px;padding:10px 0;width:400px;}#yiv5734109322 .yiv5734109322attach div a {text-decoration:none;}#yiv5734109322 .yiv5734109322attach img {border:none;padding-right:5px;}#yiv5734109322 .yiv5734109322attach label {display:block;margin-bottom:5px;}#yiv5734109322 .yiv5734109322attach label a {text-decoration:none;}#yiv5734109322 blockquote {margin:0 0 0 4px;}#yiv5734109322 .yiv5734109322bold {font-family:Arial;font-size:13px;font-weight:700;}#yiv5734109322 .yiv5734109322bold a {text-decoration:none;}#yiv5734109322 dd.yiv5734109322last p a {font-family:Verdana;font-weight:700;}#yiv5734109322 dd.yiv5734109322last p span {margin-right:10px;font-family:Verdana;font-weight:700;}#yiv5734109322 dd.yiv5734109322last p span.yiv5734109322yshortcuts {margin-right:0;}#yiv5734109322 div.yiv5734109322attach-table div div a {text-decoration:none;}#yiv5734109322 div.yiv5734109322attach-table {width:400px;}#yiv5734109322 div.yiv5734109322file-title a, #yiv5734109322 div.yiv5734109322file-title a:active, #yiv5734109322 div.yiv5734109322file-title a:hover, #yiv5734109322 div.yiv5734109322file-title a:visited {text-decoration:none;}#yiv5734109322 div.yiv5734109322photo-title a, #yiv5734109322 div.yiv5734109322photo-title a:active, #yiv5734109322 div.yiv5734109322photo-title a:hover, #yiv5734109322 div.yiv5734109322photo-title a:visited {text-decoration:none;}#yiv5734109322 div#yiv5734109322ygrp-mlmsg #yiv5734109322ygrp-msg p a span.yiv5734109322yshortcuts {font-family:Verdana;font-size:10px;font-weight:normal;}#yiv5734109322 .yiv5734109322green {color:#628c2a;}#yiv5734109322 .yiv5734109322MsoNormal {margin:0 0 0 0;}#yiv5734109322 o {font-size:0;}#yiv5734109322 #yiv5734109322photos div {float:left;width:72px;}#yiv5734109322 #yiv5734109322photos div div {border:1px solid #666666;min-height:62px;overflow:hidden;width:62px;}#yiv5734109322 #yiv5734109322photos div label {color:#666666;font-size:10px;overflow:hidden;text-align:center;white-space:nowrap;width:64px;}#yiv5734109322 #yiv5734109322reco-category {font-size:77%;}#yiv5734109322 #yiv5734109322reco-desc {font-size:77%;}#yiv5734109322 .yiv5734109322replbq {margin:4px;}#yiv5734109322 #yiv5734109322ygrp-actbar div a:first-child {margin-right:2px;padding-right:5px;}#yiv5734109322 #yiv5734109322ygrp-mlmsg {font-size:13px;font-family:Arial, helvetica, clean, sans-serif;}#yiv5734109322 #yiv5734109322ygrp-mlmsg table {font-size:inherit;font:100%;}#yiv5734109322 #yiv5734109322ygrp-mlmsg select, #yiv5734109322 input, #yiv5734109322 textarea {font:99% Arial, Helvetica, clean, sans-serif;}#yiv5734109322 #yiv5734109322ygrp-mlmsg pre, #yiv5734109322 code {font:115% monospace;}#yiv5734109322 #yiv5734109322ygrp-mlmsg * {line-height:1.22em;}#yiv5734109322 #yiv5734109322ygrp-mlmsg #yiv5734109322logo {padding-bottom:10px;}#yiv5734109322 #yiv5734109322ygrp-msg p a {font-family:Verdana;}#yiv5734109322 #yiv5734109322ygrp-msg p#yiv5734109322attach-count span {color:#1E66AE;font-weight:700;}#yiv5734109322 #yiv5734109322ygrp-reco #yiv5734109322reco-head {color:#ff7900;font-weight:700;}#yiv5734109322 #yiv5734109322ygrp-reco {margin-bottom:20px;padding:0px;}#yiv5734109322 #yiv5734109322ygrp-sponsor #yiv5734109322ov li a {font-size:130%;text-decoration:none;}#yiv5734109322 #yiv5734109322ygrp-sponsor #yiv5734109322ov li {font-size:77%;list-style-type:square;padding:6px 0;}#yiv5734109322 #yiv5734109322ygrp-sponsor #yiv5734109322ov ul {margin:0;padding:0 0 0 8px;}#yiv5734109322 #yiv5734109322ygrp-text {font-family:Georgia;}#yiv5734109322 #yiv5734109322ygrp-text p {margin:0 0 1em 0;}#yiv5734109322 #yiv5734109322ygrp-text tt {font-size:120%;}#yiv5734109322 #yiv5734109322ygrp-vital ul li:last-child {border-right:none !important;}#yiv5734109322


[Non-text portions of this message have been removed]
Jim Hill gjthill@gmail.com [sed-users]
2018-09-20 06:13:10 UTC
Permalink
Eliminating all redundancies,

sed '***@.*show=@@' showimages

The `-e` isn't needed in front of the first commandline script, and if
you're not trying to get the shell to further substitute in a
nontrivial string, put it in single quotes, and `sed`'s perfectly
capable of opening files itself, you don't need to get `cat` to do it
for you.

That doesn't error for me. I suspect you've got some editor or whatnot
that's not showing you what's really in the file, both my eyeballs and
my `sed` like what you've posted just fine, the tenth character of
what you posted is the second `@`, and can't provoke the message
you're seeing.

Also, your prose doesn't match your code: you say ~delete garbage
through "showimages~ but your command will delete garbage through
"show=".
grgoffe@yahoo.com [sed-users]
2018-09-20 14:02:38 UTC
Permalink
Cameron,

It turns out that my "script" had several sed command invocations in it so I took apart the line and found the error... one of the later seds... Sigh...

Yes, a UFU.

Thanks a lot for your help!

George...

[Non-text portions of this message have been removed]
George R Goffe grgoffe@yahoo.com [sed-users]
2018-09-20 14:08:08 UTC
Permalink
Hi,
Thanks to those (Dave, Cameron) who helped me... all info was useful.
As it turns out, my sed script had several invocations of the sed command... One of the later had a syntax error. I don't know how it worked all this time... the script had a somewhat old last changed date.
I ended up taking apart my failing command pipe and found the error.
Thanks again for the help,
George...



[Non-text portions of this message have been removed]
Loading...