$ ls | compress_spaces. $ ls | compress_spaces.sh TAB # converts multiple spaces to a single tab character 1 I need to replace all spaces which exist within quotes. You can use the following script to convert multiple spaces to a single space, a TAB or any other string: $ ls | compress_spaces.sh # converts multiple spaces to one So, for example: sed 's/\( \)*/\1/g' <<\INĪll that said, it is probably far better to avoid regexps completely in this situation and do instead: tr -s \ You can always match the last occurrence in a sequence of anything like: s/\(sequence\)*/\1/Īnd so you're on the right track, but rather than replacing the sequence with a space - replace it with its last occurrence - a single space. Use the tool âFind
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |