Skip to content

Instantly share code, notes, and snippets.

@Sarverott
Created December 12, 2025 18:30
Show Gist options
  • Select an option

  • Save Sarverott/2f2ecaf2cb1df89d2b2ac2a228f5a8e6 to your computer and use it in GitHub Desktop.

Select an option

Save Sarverott/2f2ecaf2cb1df89d2b2ac2a228f5a8e6 to your computer and use it in GitHub Desktop.
identify ttystory line by regular expression pattern: starts with at least one space, then from one up to four digits, then star char or space, then space

identify ttystory line by regular expression pattern

alias ttystory='history > ~/ttystory-$( hostname )-$( date +%s ).txt' # ttystory collector

ttystory # ttystory was been made

cat ~/ttystory* > ~/teststory.txt # puts all stories together

cat ~/teststory.txt | nodejs -e "..." # todo = pipeline exampling thingy

the pattern:

  • it has to be at start so we point on 0 char of string
  • then with at least one space must be next
  • then from one up to four digits must be next
  • then star char or space must be next
  • then space must be next
const formula = /^\s+(\d{1,4})(\*|\s)\s/ //starts with at least one space, then from one up to four digits, then star char or space, then space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment