![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Splitting the line in multiple lines | dd_sh | Shell Programming and Scripting | 3 | 03-31-2008 10:54 AM |
| Line Splitting | evoGage | UNIX for Dummies Questions & Answers | 7 | 11-30-2005 06:59 PM |
| Splitting a single line into multiple lines | thanuman | Shell Programming and Scripting | 4 | 02-23-2005 01:56 AM |
| splitting the files | sounder123 | Shell Programming and Scripting | 1 | 06-04-2004 04:03 AM |
| Splitting a line up | lilas | UNIX for Dummies Questions & Answers | 1 | 03-12-2001 09:34 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#8
|
||||
|
||||
|
Hi.
Quote:
If you run my script with the data1 file, does it work? ... cheers, drl |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
drl,
I don't understand what your data1 file is. Spin |
|
#10
|
|||
|
|||
|
Or rather:
could you explain precisely the syntax in the script to read the data1 file? Is data1 a filename? |
|
#11
|
|||
|
|||
|
OK, I tried your script with a file named (data1) and it comes close to working. Except the only thing is that the modified text splits into two lines
-------------Do cument 7 of 9 I double-checked where the newline character is in the replacement portion of my script and it appears to be right where it should be. |
|
#12
|
||||
|
||||
|
Hi.
OK, that sounds like progress. As I did, please post the script and the output, using CODE tags around them to make them readable ... cheers, drl |
|
#13
|
|||
|
|||
|
OK: now I'm trying this again, and for some reason it's failed to work.
Here is the precise script I'm running: #!/bin/sh # @(#) s1 Demonstrate sed line split and merge. set -o nounset echo " sh version: $BASH_VERSION" >&2 sed --version | head -1 FILE=${1-data1} echo echo " Input file:" nl $FILE cat >script <<'EOF' /==Document$/ N s/==Document\n/==\nDocument/ } EOF echo echo " Output" sed -f script $FILE | nl exit 0 When I run this on data1 (I've taken one of my own text files and renamed it data1 to match the script), it cats the file with numbered lines and then reads this output error: Output sed: 1: script: command expected |
|
#14
|
||||
|
||||
|
Hi.
You are missing a curly brace in the script: Code:
cat >script <<'EOF' /==Document$/ N s/==Document\n/==\nDocument/ } EOF Code:
cat >script <<'EOF'
/==Document$/{
N
s/==Document\n/==\nDocument/
}
EOF
|
||||
| Google The UNIX and Linux Forums |