Skip to main content
15 events
when toggle format what by license comment
Oct 14, 2013 at 16:32 comment added slm @John - the extensions in Linux are irrelevant, they're just so that operators of the computer know what the file is 8-). To make it sed1, change this line like so: cat > sed1 <<EOF. Everything else should stay the same.
Oct 14, 2013 at 16:20 comment added John Alright thanks! How would I made a sed script called sed1 though? I see yours is called script.bash. Is the .bash extension required?
Oct 14, 2013 at 16:07 comment added slm @John - Sorry I thought you might be asking that but didn't want to offend you. You can use a editor such as nano to create this file. Also I updated my answer showing how you can make the file using the cat command.
Oct 14, 2013 at 16:07 history edited slm CC BY-SA 3.0
added 351 characters in body
Oct 14, 2013 at 15:56 comment added John Just to clarify, I do know how to use a created sed script file on a file, I just do not know exactly how to create the sed script and put the commands in it =/ Sorry guys.
Oct 14, 2013 at 15:10 comment added slm @John - that is called a shebang line. That makes this file a script, and tells the shell what interpreter to use, in this case we're using Bash.
Oct 14, 2013 at 15:06 comment added John I am still a bit confused as to how the sed1 script is made. What is this doing? #/bin/bash Also I have tried using these commands: #/bin/bash sed -i ' 4i\ s/,/\t\t/ s/,/ / ' "$@" but I get error message: sed: no input files
Oct 14, 2013 at 4:49 comment added slm @John - see my example above, I made a file called script.bash, put the contents as I mentioned into it, make it executable, and run it like this, script.bash baconFile.
Oct 14, 2013 at 4:46 comment added slm @GregHewgill - that's what I thought, I took that last statement out, thanks!
Oct 14, 2013 at 4:46 history edited slm CC BY-SA 3.0
deleted 65 characters in body
Oct 14, 2013 at 4:44 comment added Greg Hewgill It is possible to use the shebang line #!/usr/bin/sed -f - to write a sed script as a callable script. EDIT: Actually that seems to depend on the implementation of sed. GNU sed does not appear to support -f -, and that is what most people are probably using these days. Actually, BSD sed doesn't support this either, but AIX sed does. Go figure!
Oct 14, 2013 at 4:43 comment added John Sorry, still a bit confused as to how to actually create a sed file, say sed1, then put the commands inside of it, then use it on a file, say baconFile. Sorry.
Oct 14, 2013 at 4:16 history edited slm CC BY-SA 3.0
added 87 characters in body
Oct 14, 2013 at 4:07 history edited slm CC BY-SA 3.0
added 170 characters in body
Oct 14, 2013 at 4:02 history answered slm CC BY-SA 3.0