Path: utzoo!utgpu!watmath!att!pacbell!ames!xanth!ginosko!uunet!virtech!cpcahil From: cpcahil@virtech.UUCP (Conor P. Cahill) Newsgroups: comp.unix.questions Subject: Re: sed behaves differently when run in backquotes/subshell Keywords: `sed`, sh, microport_system_V/AT Message-ID: <958@virtech.UUCP> Date: 8 Aug 89 00:23:04 GMT References: <350@tree.UUCP> Organization: Virtual Technologies Inc Lines: 12 In article <350@tree.UUCP>, stever@tree.UUCP (Steve Rudek) writes: > I needed a shell script which would take strings of letters and alphabetize > them into a single line and sed + sort seemed like the best choice. But I find > that sed performs differently when part of a pipeline not explicitly in a > subshell than it does when run in backquotes. What's the problem? It is not set which mis-behaves, but the shell. When you run in the `sub-shell` the "^j" is eaten by the shell command line processing. A different mechanism would be to use the tilde instead of the and then translate the tilde to a . For ex: GUESSES=`cat .TST | sed 's/\(.\)/\1~/g' | tr "~" "\012" | sort....