# sed help please

**URL:** <https://boards.straightdope.com/t/sed-help-please/309178>\
**Category:** Factual Questions\
**Created:** [June 21, 2005, 9:21am UTC](https://boards.straightdope.com/t/sed-help-please/309178 "2005-06-21T09:21:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sage\_Rat](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/sage_rat/32/399_2.png) [@Sage\_Rat](https://boards.straightdope.com/u/Sage_Rat)\
**Post date:** [June 21, 2005, 9:21am UTC](https://boards.straightdope.com/t/sed-help-please/309178/1 "2005-06-21T09:21:23Z")

</div>

I’m trying to run a script that patches the Linux kernel source, but it errors and dies midway through saying _sed: invalid option – 1_. My current guess is that this is referring to the following line in the script:

```auto

sed 1,"$CRAMFS"d fs/Config.in >>Config.tmp

```

I don’t know sed, and the inclusion of a number and comma indeed doesn’t resemble what the man page shows for input parameters. Assuming this is some sort of deprecated calling syntax, does anyone know how I can rewrite it so the script will work?

Thank you

---

<div class="post-metadata">

**Author:** ![Sage\_Rat](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/sage_rat/32/399_2.png) [@Sage\_Rat](https://boards.straightdope.com/u/Sage_Rat)\
**Post date:** [June 21, 2005, 10:05am UTC](https://boards.straightdope.com/t/sed-help-please/309178/2 "2005-06-21T10:05:59Z")

</div>

Nevermind… :o

The calling parameters for the script had changed from what was listed in the documentation. (I’m thinking the “1” is a macro for the first argument?) Anyhoo, apologies for the spam.

---

<div class="post-metadata">

**Author:** ![Noone\_Special](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/noone_special/32/2863_2.png) [@Noone\_Special](https://boards.straightdope.com/u/Noone_Special)\
**Post date:** [June 21, 2005, 10:07am UTC](https://boards.straightdope.com/t/sed-help-please/309178/3 "2005-06-21T10:07:00Z")

</div>

Haven’t done any SED since… well a long time, anyway.

Pretty sure that there should be a space between the “$CRAMFS” (which should be a numeric value, denoting up to which line to do the changes) and the \<d\> character (which means “delete the line”). Basicly (IIRC how SED syntax works), the script should delete the first $CRAMFS lines of fs/Config.in and wrtie the result to Config.tmp.

You should most certainly back up **all** of the relevant files before trying any of my advice, however :eek:

Dani

---

<div class="post-metadata">

**Author:** ![Noone\_Special](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/noone_special/32/2863_2.png) [@Noone\_Special](https://boards.straightdope.com/u/Noone_Special)\
**Post date:** [June 21, 2005, 10:08am UTC](https://boards.straightdope.com/t/sed-help-please/309178/4 "2005-06-21T10:08:50Z")

</div>

Gah, simulpost!

So what was the command you ended up giving to SED? Inquisitive minds want to know!

---

<div class="post-metadata">

**Author:** ![Sage\_Rat](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/sage_rat/32/399_2.png) [@Sage\_Rat](https://boards.straightdope.com/u/Sage_Rat)\
**Post date:** [June 21, 2005, 10:23am UTC](https://boards.straightdope.com/t/sed-help-please/309178/5 "2005-06-21T10:23:41Z")

</div>

No idea. It was just a line in the shell script.

I saw the place in the shell script where it (was supposed to but **did not** ) show the usage parameters, so rerunning with proper parameters for the script itself went. The one I was using had, apparently, been deprecated. (Running it without parameters should ahve shown the usage, but instead popped open the file itself in a text editor! 😕 Gotta love computers. 😃 )
