Below is my learners cheat sheet of sam commands which I am enclosing should find it helpful. I welcome any suggestions and/or corrections. These have been put together mostly from the standard resources, but there are gaps in my knowledge.  $ - end of line/file $-/vi/ -- search from end of the file backwards 0,$ t "peter.c" 0 -- copy dot from 1 file to another 0 send dot to stdin of command ,|sort -- sort the file , > spell -- check spelling # substitute #'th tagged pattern ,t "junk.c" 0 -- copy current file to start of junk.c |tr a-z A-Z -- change case ,| uniq -- delete juxtaposed duplicates blank lines /vi/+- m 0 moves the line containing "vi" to the top of the file /vi/ or +/vi/ -- search forward /vi/+- t 0 copies the next line with vi to the top of the file /vi/+/vi/ -- search for the second occurrence of "vi" following dot v/regexp/ command -- If dot does not contain, run command ,>wc -l -- count lines in file ,>wc -- word count of current document w writes the whole file to disk or parts of a file x/$^/!# -- comment a line ,x/ +$/d .x/'+$/i/ --color-auto/ x/$^/!# ,x/^$\n/d x/$^/!# ,x/[0-9]/d x/^/.,/0d -- strip C comments from selection ,x/^/a/ / -- indents blocks of text with a tab stop. ,x/[a-zA-Z0-9]+/-#0;+#1| tr a-z A-Z -- capitalise every word (slow) ,x/[‘‘’’“”‘’]/c/" X/\.c$/ ,x/variable/+-p -- find all uses of a variable in the C source files ,x/‘‘|’’/c/"/ -- change smart quotes to curly x cmd - set dot and run command on each matching line ,x/  +/d ,x/\*/d ,x/^ +/d ,x/\*/d -- delete all asterisks ,x/^ /d -- deletes the indents X D -- remove out all up to date files ,x/^ +/d -- Remove the space at the beginning of the line ,x g/^$\n/d -- delete blank lines ,x/good/ c/bad/ ,x g/vi/p - idem ,x/^http.[^,]*?/d ,x/^http.[^,]*?/d -- search for "http...," and delete ,x/\n+/a/\n/ -- finds every occurrence of 1 or more (+) newlines (\n) and appends a new line. ,x/.*\n/ g/ed/ v/red/ p -- find ed but not red ,x/(.+\n)+/ g/It was the best of times/ p ,x /.*\n/ g/vi/ p - break file into lines, if lines contain "vi, print ,x/\n\n\n+/c/\n -- idem .x/Peter/d -- search dot for 'Peter' and delete 'Peter' X/regex/b -- switch to a loaded file with a regex X/regexp/ command -- Run command on files whose menu line matches x/regexp/command - set dot and run command on each match X/\.sam$/,x/the/+-p -- search multiple files for text and print the results .x s/.*/echo "&."/ ,x s/good/bad/ ,x s/\.\.\n/g -- break sentences into new lines ,x s/\\p/\n\n/g ,x s/\\s/\n\n/g ,x//|tr a-z A-Z x/^/d -- remove 1 tab of indent from selection ,x/teh/c/the/ ,x/^TODAY$//d -- strip from all files X ,x/(.+\n)+/ g/account/p ,y/best/ x/(.+\n)+/g/It was the best of times/p Y/regexp/ command -- As X but select unmatched files y/regexp/ command -- as x but select unmatched text ,x[a-zA-Z]+/{ g/fred/ v/...../ c/jim/ g/jim/ v/..../ c/fred/ } -- swap fred for jim in file ,x/Emacs|vi/{ g/Emacs/ c/vi/ g/vi/ c/Emacs/ } Go from search results in sam window to document: ,x g//{ p } ,| ssam -f your_script As for comments in scripts, if you use ssam(1) to run them the easiest way would be starting the lines you want to be ignored with a character that isn't a sam command - this will work because ssam sends stderr to /dev/null. ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tc2ebea6bfef26073-M5318338af59b6b616cd4210c Delivery options: https://9fans.topicbox.com/groups/9fans/subscription