The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
3answers
81 views

What perl script will scp directory with spaces in name?

I"ve been trying for several hours to figure out how to get perl to scp a directory with a space in the name. I'm currently getting the error scp: ambiguous target Here is the script that is not ...
3
votes
1answer
98 views

Rename files with spaces in a BusyBox shell

I'm trying to rename some files on my Synology Diskstation via SSH. The available shell is the BusyBox built-in shell: BusyBox v1.16.1 (2013-04-16 20:13:10 CST) built-in shell (ash) The move ...
1
vote
3answers
76 views

operator in if condition

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"] ...
2
votes
1answer
66 views

csplit not obeying backslash r \r as carriage return

I have a file with \r\n line endings (CRLF carriage return line feed). This command works: $ csplit --silent --prefix=email-emailbad.txt- \ --digits=3 emailbad.txt '/^\.^M/'+1 '{*}' This ...
18
votes
2answers
659 views

Why does my shell script choke on whitespace or other special characters?

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 ...
0
votes
1answer
49 views

Why does vim jump down to same position after multiple spaces?

I really can't find the answer to this and I would like to understand what going on behind the scenes to make this happen. Is it a setting I have switched on? If so, which one? To give an example, I ...
2
votes
2answers
286 views

How to add a string with spaces at the end of command output

I want to add a string with spaces at the end of each line of the output of ls command. #!/bin/sh STRING_WITH_SPACES="this should be at the end of output" ls -lh | sed 's|$| '$STRING_WITH_SPACES'|' ...
1
vote
2answers
112 views

Why are bash tests so picky about whitespace?

As a primarily Java programer, I find the bash if-then construct quite confusing, especially regarding whitespace. Can anyone explain, why the first one works but not the second and third? #works if ...
2
votes
3answers
86 views

Why does bash have a HISTCONTROL=ignorespace option?

Or to phrase it differently, why would you want to prevent commands from being written to the bash history? (Inspired by a related question.)
11
votes
1answer
199 views

Why is bash not storing commands that start with spaces?

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 ...
1
vote
1answer
80 views

Sed: search and replace a patten with special characters which has a arbitrary string in between

I have a load of nfo files which I want to make some global substitutions for some values within each file e.g. a.nfo has the value <set>Tonight&apos;s Menu ( June 2012 )</set> ...
3
votes
1answer
84 views

Trailing spaces when copying from gnome-terminal using zsh

When copying text from gnome-terminal with zsh trailing whitespace is also copied. For example copying the following clearly adds a vertical scollbar on stackexchange site as trailing whitespace the ...
2
votes
3answers
556 views

How to identify and remove invisible whitespace characters on gedit?

I want to remove unnecessary whitespace on my css file. I am using grep with the command as follows: $ grep -rn "[[:space:]]$" Surprisingly, it is returning a hit on every line in the file. I ...
3
votes
1answer
110 views

terminal command that prints out tabs, spaces, and newlines as \t \s and \n

I wrote a terminal program in c that converts tabs to spaces. And I would like to see that it works and how many spaces were converted from tabs. The problem is when I create a file called input.txt ...
8
votes
3answers
118 views

POSIX compliant way to work with a list of filenames possibly with whitespace

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 ...
5
votes
4answers
953 views

how do I trim each line in bash?

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?
1
vote
1answer
55 views

Emacs - Strange Whitespace

(I posted this same general question here on StackOverflow thinking it had something to do with my emacs configuration, but after following a comment there, I think it is exclusive to urxvt) My ...
5
votes
2answers
363 views

Quoted vs unquoted string expansion

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 ...
0
votes
1answer
153 views

Unexpected whitespace using sqsh in command substitution [closed]

Below shell script instruction behave in weird way ARG_DATE=`sqsh -S $SERVER -U $DB_USER -P $DB_PASSWORD -D dbname -h<<END SET NOCOUNT ON go select convert(varchar, PRIOR_COB_DATE, 112) from ...
5
votes
2answers
239 views

Bash commands with spaces in them (git config or git-config?)

Please forgive me if this seems easy, but I only started learning Unix 2 days ago. Basically, I have been taught that when typing a command into the terminal it needs to be of the form: [command ...
5
votes
3answers
2k views

vi / vim - how to automatically strip trailing spaces on save?

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
0
votes
2answers
922 views

what is “an invisible whitespace character that takes up space”

One can look up Unicode Characters with Regular Expressions. On Jan Goyvaerts website I found a RegExp whose meaning I don't understand : \p{Zs} or \p{Space_Separator}: a whitespace character that ...
3
votes
2answers
187 views

Generic Preprocessor adds extra whitespace

Following up on this article I use GPP to empower Markdown parser pandoc with some macros. Unfortunately, gpp seems to copy all whitespace into the result. For example, consider file test.md % Title ...
2
votes
1answer
302 views

How to use whitespace in procmailrc recipe destination path?

I use Mutt Maildir for storage mails. I created one mailbox like this Stack Exchange/. (whitespace between Stack and Exchange here) procmailrc recipe: :0 * From: .*Stack\ Exchange Stack Exchange/ ...
2
votes
1answer
79 views

Emacs + whitespace: ignoring 'normal' spaces

I would like to use whitespace to detect wrong whitespace (i.e. trailing whitespace on line, tabs instead of spaces etc.). However I would like to still have spaces displayed as spaces. I tried to ...
5
votes
2answers
14k views

Removing all spaces, tabs, newlines, etc from a variable?

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 != ...
4
votes
2answers
1k views

Using files that have spaces in their name in pipes

I have folder named play which contains a file damn file (with space). When I use find and pipe the output to tar: find play/ -name 'damn*' | tar cf archive.tar -T - It works perfectly. Why does ...
3
votes
2answers
4k views

Strip trailing whitespace from files

The answer to removing trailing whitespace with sed has most of the answer, but I want sed -i 's/[ \t]*$//' $1 to be able to take arbitrary number of file arguments as a shell script on the command ...
2
votes
1answer
566 views

Rsyncing multiple files with white spaces in the names

I'm trying to back up files onto a server, but I'm having problems with files that have white spaces in the names. I'm using this command in terminal: FILES="testing/space\ in\ filename testing/and\ ...
11
votes
1answer
8k views

Ignore whitespaces changes in all git commands

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 ...