Skip to main content

Questions tagged [whitespace]

combination of spaces, tabs, or newlines which create "empty" space in a line or column

423 votes
22 answers
859k views

I would like to remove all leading and trailing spaces and tabs from each line in an output. Is there a simple tool like trim I could pipe my output into? Example file: test space at back test ...
rubo77's user avatar
  • 30.7k
0 votes
2 answers
62 views

Is there any hope of using $(<D) here? Any hope of avoiding the mystery dots? $ cat Makefile D=$(HOME)/Downloads test: $D/DreamHost\ Web\ Panel\ _\ Mail\ _\ Message\ Filters.html : mv "$&...
Dan Jacobson's user avatar
378 votes
6 answers
422k views

… or an introductory guide to robust filename handling and other string passing in shell scripts. I wrote a shell script which works well most of the time. But it chokes on some inputs (e.g. on some ...
Gilles 'SO- stop being evil''s user avatar
2 votes
1 answer
588 views

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" &...
Adalbert Hanßen's user avatar
7 votes
4 answers
3k views

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, ...
rhuanpk's user avatar
  • 423
0 votes
2 answers
118 views

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: $ ...
user7543's user avatar
  • 266
156 votes
6 answers
83k views

In Vim, if I paste this script: #!/bin/sh VAR=1 while ((VAR < 10)) do echo "VAR1 is now $VAR" ((VAR = VAR +2)) done echo "finish" I get these strange results: #!/bin/...
elbarna's user avatar
  • 14.8k
3 votes
1 answer
181 views

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?
edman's user avatar
  • 598
1 vote
1 answer
120 views

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 ...
René Nyffenegger's user avatar
1 vote
2 answers
2k views

Another user helped me earlier to fix something I'm doing with awk, where I search for a string at any point in all files and replace two numbers in the same line when I find it. awk -i inplace '/^...
the_pocket_of_big_noob's user avatar
11 votes
4 answers
39k views

I am trying to print two string separated by a TAB. I have tried: echo -e 'foo\tbar' printf '%s\t%s\n' foo bar Both of them print: foo bar Where the whitespace between the two is actually 5 ...
Asu's user avatar
  • 225
7 votes
4 answers
17k views

In my directory I have two files with space, foo bar and another file. I also have two files without space, file1 and file2. The following script works: for f in foo\ bar another\ file; do file "$...
Pedro Siqueira's user avatar
85 votes
2 answers
28k views

If I perform a sequence of commands like: $ ls $ grep abc file.txt and then use the up arrow key to get the previous one, the terminal will show the last cmd (which is the grep here) But if I do ...
sandyp's user avatar
  • 1,197
55 votes
4 answers
146k views

This is the error I am getting and it's failing because of a variable whose value is supposed to be 2 (I am getting this using a select * from tabel). I am getting spaces in that variable. + 0 != ...
munish's user avatar
  • 8,237
3 votes
3 answers
2k views

I would like to selectively replace a command-line argument that is being passed to automatically format it for the downstream command being executed. The argument will have spaces and that is the ...
Walter's user avatar
  • 1,274

15 30 50 per page
1
2 3 4 5
12