Questions tagged [whitespace]
combination of spaces, tabs, or newlines which create "empty" space in a line or column
166 questions
0
votes
2
answers
87
views
One-liner piping from find/xargs with paths including spaces
The following question likely does not relate specifically to Vim. I use a Vim example, as this is where I encounter the issue.
Working on Ubuntu, I often open multiple files in Vim using tab pages:
$ ...
2
votes
1
answer
387
views
How can I take a sub-array in bash of the first N elements of a string array with elements containing spaces?
This question is similar to this one but it differs from it:
Consider this array with string elements which may contain spaces:
a@W:$ arr=("eins" "zwei" "eins plus zwei" &...
1
vote
1
answer
99
views
How can I iterate over the white space separated words returned by a command substition?
I have the following simple shell command:
for x in $(echo one two three); do echo $x; done
When executed, it simply prints
one two three
on one line, i. e. the result of the command substitution is ...
3
votes
1
answer
162
views
Showing whitespace in Ed
In Ed I can test for whitespace with this regex: g/ *$/p. I don't suppose there is a way of showing whitespace, perhaps by passing the contents of the buffer to another shell command?
1
vote
1
answer
75
views
How to use unix `mv` to rename files with unicode spaces(not U+20)?
$ ls cn*
cn blah blah.txt
$ ls cn\ *
ls: cannot access 'cn *': No such file or directory
$ ls cn*|hexdump -C
00000000 63 6e e2 80 85 62 6c 61 68 c2 a0 62 6c 61 68 2e |cn...blah..blah.|
00000010 74 ...
7
votes
4
answers
3k
views
Why does a backslash at the end of the line place undue whitespace?
I wanted:
#!/bin/bash
cmd --options \
option=value,\
option=value,\
option=value,\
option=value
But running with bash -x I got:
cmd --options option=value, option=value, option=value, ...
0
votes
1
answer
48
views
How to make emacs start in bash by visiting a find command result containing whitespace in its name and double quotes in path? [duplicate]
I'm confronted with an escape challenge:
The process:
Step 1 - the file retrieval:
Within bash, find command will be invoked.
Find commands output is 1 single file with a path like this:
./vacation/...
1
vote
1
answer
106
views
Expand tabs in file with utf8 characters
I use expand to expand tabs to spaces. For utf8 files expand doesn't work correctly. E.g. in ć\ta tab is expanded to 6 spaces while in a\ta to 7 spaces.
How do I make it work for utf8 files?
0
votes
3
answers
798
views
Adding 10 whitespace characters using sed
I have written a script that replaces a string, but I need to add the 10 whitespace characters back. I can add it back by pressing space 10 times, and that works, but this looks hideous in my script.
...
0
votes
3
answers
919
views
How can I test if a string has any ASCII white space characters in it?
How can I check if a string has any whitespace characters in it? I do not have to worry about things outside of ASCII for example unicode zero width characters etc. You can assume that the string is ...
0
votes
2
answers
85
views
Shell function to center its first argument
In the nano text editor, I can pipe the selection into a command, and I quite often need to center text, so I came up with the following code
center() {
str=$1
# Strip leading and trailing ...
-1
votes
2
answers
52
views
Unable to remove space for filenames [closed]
I'm unable to remove space from filenames as below, Please advise if any solution is there on this issue. thank you
/home/files:
Dec 14 22:10 testfiles
Dec 15 12:30 test file1
Dec 14 21:45 test ...
0
votes
5
answers
398
views
Whitespaces in alias bashrc
I use Bash
I wrote a command for printing only docker id separate with whitespaces on one line.
docker ps -a | grep -E '^[a-z0-9]{12}' -o | awk '{printf "%s ",$0} END {print ""}'
...
1
vote
1
answer
841
views
spaces in filenames -- general prevention strategies
Spaces in filenames are a problem which is as known as enervating. Nevertheless, there does not seem to be a big list how to prevent them, nor does prevention seem to be supported by the common static ...
1
vote
1
answer
1k
views
Why does nano indent pasted text or code improperly?
When I copy and paste text from the clipboard, the code looks like
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
...