Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
_flux
19 days ago
|
parent
|
context
|
favorite
| on:
Using jq to format JSON on the clipboard
I use similar approach for fixing up clipboard contents with
tr '\n' ' ' | sed 's/\t/ /g; s/ */ /g'
But also I switched to xsel at one point, as xclip doesn't seem to deal as well with unicode. It could be xclip has been fixed since then, though.
CamJN
19 days ago
[–]
/\ \ */ is the same as / +/, but if you only want to replace 2+ spaces and leave the single spaces alone, then what you really want is /\ \ +/.
Edit: had to escape the spaces because HN ate my spaces.
_flux
19 days ago
|
parent
[–]
You need to use -E to get that behavior with GNU Sed.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: