Re: [9fans] sam and 'here documents' on Unix [WAS: Re: Making multiple changes to dot using sam -d]
hmm, interesting. ^ is indeed very useful; making it work in sam -d is probably the correct thing to do but here's a quick hack. (9front specific, tho you can probably figure out another way to pretend you typed.) umbraticus ; fn f{echo ,x/red/c/blue >/dev/kbdin} ; sam -d -. a I hired a red redemptionist . !f ,x/red/c/blue , I hiblue a blue blueemptionist -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tcf06324837558cea-M37afd51dab499eefb093aa10 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
[9fans] sam and 'here documents' on Unix [WAS: Re: Making multiple changes to dot using sam -d]
A related question: 9front sam has the ^ command, which makes it easy to apply multiple sam commands to the dot from a script, e.g: #!/bin/rc cat << END ,x/red/ c/blue/ ,x/yellow/ c/green/ END How does one accomplish this in oldschool Unix sam -d without the ^ command, and also without using ssam? 'Here dcuments' work, because the following works fine on my shell (Busybox sh, not rc): $ sam -d file.txt << END ,x/red/ c/blue/ ,x/yellow/ c/green/ w q END However, piping dot to that script from within sam -d (using the | command) ends up with: sh: script.sh: not found ?warning: exit status not 0 ...and also an empty (deleted) sam buffer. Replacing 'cat' with other options, e.g. 'sam -d "$*"', eventually gave a "broken pipe" message. And, again, in all cases, an empty buffer. So, no ^ command, no ssam, but want to use substitutions from 'here documents' -- where am I going wrong? Many thanks, Mart On 11/05/2022, revcomni...@gmail.com wrote: > Thank you! I was erring in that I failed to repeat x. -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tcf06324837558cea-M5ef5eba93c3c87f8333b2b8e Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] Deleting lines in sam - d
I have applied the script and the suggestions are fantastic. For the kind of work I am doing now, having the numbers helps me a lot, although I do also understand the point Christ is making. Many thanks! -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tc5c492077a61275c-M66ddefc2515608e8640fc173 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription
Re: [9fans] Deleting lines in sam - d
I mean, if you really want it, you can ,|awk '{print NR "\t" $0}' then ,x/^[0-9]+ /d or something. umbraticus -- 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tc5c492077a61275c-Mf73fea5ddae7354548491a99 Delivery options: https://9fans.topicbox.com/groups/9fans/subscription