Skip to content

Instantly share code, notes, and snippets.

@nicholashoule
Last active January 19, 2022 18:07
Show Gist options
  • Save nicholashoule/d53f4d8c20a60584aff276f964253277 to your computer and use it in GitHub Desktop.
Save nicholashoule/d53f4d8c20a60584aff276f964253277 to your computer and use it in GitHub Desktop.

sed

NAME
     sed -- stream editor

SYNOPSIS
     sed [-Ealn] command [file ...]
     sed [-Ealn] [-e command] [-f command_file] [-i extension] [file ...]

DESCRIPTION
     The sed utility reads the specified files, or the standard input if no
     files are specified, modifying the input as specified by a list of com-
     mands.  The input is then written to the standard output.

Remove leading and trailing quotes ( "Example", )

printf '%s' ' "The test case", ' | sed 's/^[\s \t     ]*//g; s/\"//g; s/[",]//g'
printf '%s' '    "The test case", ' | sed 's/^[\s \t     ]*//g; s/\"//g; s/[",]//g'
printf '%s' '                         "The test case", ' | sed 's/^[\s \t     ]*//g; s/\"//g; s/[",]//g'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment