Print only the content inside double quotes on each line.

Section: sed and Stream Editing

Extract quoted content

bash
bash
sed -En 's/.*"([^"]+)".*/\1/p' file.txt
Explanation

The `-n` flag suppresses normal printing; `p` prints only successful substitutions.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing sed and Stream Editing
Reformat date
Convert YYYY-MM-DD into MM/DD/YYYY.
OpenIn sheetbashsame section
Trim trailing spaces
Remove trailing whitespace from each line.
OpenIn sheetbashsame section
Prefix non-empty lines
Add a prefix only to non-empty lines.
OpenIn sheetbashsame section
sed regex replacement
Replace all runs of whitespace with a single space.
OpenIn sheetbash1 tag match
grep whole word
Find full-word matches in files.
Atomic group in PCRE
Avoid backtracking inside a grouped token.