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
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
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
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
34 votes
4 answers
24k views

Is there a .vimrc setting to automatically remove trailing whitespace when saving a file? Ideally (to be safe) I would like to only have this functionality for certain files, e.g. *.rb
Michael Durrant's user avatar
31 votes
1 answer
41k views

I've found tons of sites that explain how to have git warn you when you're changing line endings, or miscellaneous other techniques to prevent you from messing up an entire file. Assume it's too late ...
Michael Mrozek's user avatar
20 votes
2 answers
12k views

I am using the below script to move two days back when script runs at starting two days of the year and also check first and second days of every month and move two days back. if [$month="01"...
Kumar1's user avatar
  • 341
17 votes
5 answers
32k views

I have a file that contains a list of names. i.e.: Long Name One (001) Long Name Two (201) Long Name Three (123) ... with spaces and some special characters. I wanted to make directories out of these ...
Majal's user avatar
  • 383
17 votes
2 answers
7k views

I have seen Bash scripting guides suggesting the use of array for working with filenames containing whitespace. DashAsBinSh however suggests that arrays are not portable so I am looking for a POSIX ...
Eero Aaltonen's user avatar
15 votes
3 answers
10k views

Or to phrase it differently, why would you want to prevent commands from being written to the bash history? (Inspired by a related question.)
LoicAG's user avatar
  • 273
15 votes
7 answers
17k views

It's this annoying behavior I've been experiencing here and there occasionally: when you select text with mouse in console (that is, copy it), paste it, and realize you've got extra spaces at the end ...
x-yuri's user avatar
  • 3,653
14 votes
2 answers
10k views

As a primarily Java programmer, I find the bash if-then construct quite confusing, especially regarding whitespace. Can anyone explain why the first one works, but not the second or third? #works if [...
Konrad Höffner's user avatar
14 votes
2 answers
8k views

for i in $(xrandr); do echo "$i" ; done for i in "$(xrandr)"; do echo "$i"; done for i in "$(xrandr)"; do echo $i; done I understand why 1 differs from 2. But why does 3 give a different output from ...
ManuelSchneid3r's user avatar
13 votes
1 answer
10k views

On this website it says: [[:blank:]] space and tab characters [[:space:]] whitespace characters What's the difference between space and tab characters and whitespace characters? To me, they ...
14wml's user avatar
  • 243

15 30 50 per page
1
2 3 4 5
12