General :: Getting Blank Spaces In Shell Script?
May 7, 2010
I did the following script:
Code:
DIR=`pwd`;for i in `find . -name GESTION -type d`;do cd $i/..;setfacl -R -m g:directores:rwx,
GESTION;echo $DIR'/'$i;cd $DIR;done
This code do the following actions:
1. Starting inside a folder, it's searching for any folder called "GESTION"
2. Every time a folder called "GESTION" is found, then the script move to its parent folder, and then it applies ACL permissions to the folder GESTION by using the command setfacl.
The problem is that the script doesn't works when there was found a folder with a blank space in its name. I mean:
/dir1/dir2/dir3/GESTION --> this works fine
/dir1/dir2/dir 3/GESTION --> this doesn't works
/dir1/dir2/dir3/2. GESTION --> this doesn't works
View 4 Replies
ADVERTISEMENT
Jan 26, 2010
Is it possible, in Linux, to rename a file from something without spaces to something containing spaces? I know I can create directories and files with spaces by doing:
mkdir "new dir" and:
touch "new file.txt"
I want to rename files from:
imgp0882.jpg to something like:
20091231 1243 some topic.jpg
And how would it look in a shell script that uses parameters like:
for i in *.jpg do
rename "$i" "$somepath/$mydate $mytime $mytopic$extension"
?
I'm new to Linux (using PCLinuxOS 2009.2), coming from Windows, and I've written myself a little shell script to download files from my camera and then automatically rename them according to a date-and-topic pattern. As you can guess by now, I'm stuck on the bit about renaming. If you want to see my script, here's a copy. I'm not using jhead for this renaming because that only works with JPEG files but I want a single solution for any media format including videos.
View 2 Replies
View Related
Oct 7, 2009
need all spaces between two letters or a letter and a number exchanged for an underscore, but all spaces between a letter and other characters need to remain. One example for clarity:
Input:
force -- lamin 90 [label]
active A -- generation [label]
needed Output:
force -- lamin_90 [label]
active_A -- generation [label]
I tried solving this with sed but obviously s/ /_/g does not work, nor does any s/[a-zA-z0-9] [a-zA-z0-9]/[a-zA-z0-9]_[a-zA-z0-9]/g , because you just can't do this...
View 2 Replies
View Related
Jun 8, 2011
I named a number of files with spaces in them, and I want to replace the space with "_". However, every time I write a command in the shell with the file name (eg "Spring 2011"), the shell doesn't recognize the file or directory. What can I do about this? Is there any way to use the unicode character for a space?
View 5 Replies
View Related
Aug 25, 2010
I have two sets of data. 1,2,3,4 and 6,7,8 and I have written a fortran code to put them in order as below:
program gap
implicit none
integer:: i, j
do i = 1,4
do j = 6, 8
[Code]...
I want a space once every row loop has finish.I am dont know how to write the data as shown above using the fortran code in this post.
View 2 Replies
View Related
May 26, 2010
I'm trying to use a tilde '~' for a filename. This works fine normally Code: rm ~/File
But when I have a file with a space in in and enclose it in quotes it takes it literally.If a word begins with an unquoted tilde character (�~�), all of the characters up to the first unquoted slash (or all characters, if there is no unquoted slash) are considered a tilde-prefix.
View 5 Replies
View Related
Dec 10, 2010
A process with name=example can be killed by killall -9 example
How to kill multiple instances of following command which contain spaces?
"valgrind --tool=lackey ./testcases/kernel/syscalls/waitpid/waitpid03"
Following command returns valgrind --tool=lackey ./testcases/kernel/syscalls/waitpid/waitpid03: No such file or directory
View 3 Replies
View Related
Feb 2, 2011
Ive some textfiles which contains some colums seperated by a various number of spaces, but instead i need one single tab as a seperator.
View 5 Replies
View Related
Jan 5, 2011
I have a line like
port = 2566
I want to replace it as
port = 8080
how to do this in shell script. when i tried to do this with sed
sed -i 's/port=.*/port='$3'/' /root/$2
it is not recognizing spaces , it works only if line is port=2566 .
View 6 Replies
View Related
Jan 21, 2010
I am trying to run an scp command on my linux server, this is working fine, however I changed the output folder to one which has spaces and now when run, it's coming up saying SCP ambiguous target
Here's my string:
expect -c 'spawn scp -r /var/lib/asterisk/backups/Everyday/ administrator@192.1.1.1:
/Volumes/Data1/My Backup Folder/ ; expect assword ; send "MYPASSWORD " ; interact;'
View 4 Replies
View Related
Jul 2, 2010
I have a lot of files with tabs littered throughout, and I'd like to convert them all into spaces. I know about the expand command, but unfortunately I would have to type out every single file using it. Is there any easier way to do this on Linux?
View 2 Replies
View Related
Sep 14, 2010
I am reading the output of /proc/acpi/thermal_zone/ATF0/temperature in a program to read my CPU temp. I am using cat like the following:
Code:
#cat /proc/acpi/thermal_zone/ATF0/temperature
temperature: 49 C
I basically want to get rid of the spaces in between temperature and the actual temperature. Is there a command I can pipe the cat output to, to remove the spaces. I have seen suggestions for sed, or tr, but for some reason I cannot get them to work properly.
View 14 Replies
View Related
Mar 11, 2011
my requirement is i need to copy mail subject to a text file and create one directory from the name of subject.
my MAIL subject is like this :
Quote:
Subject:Thanks to linuxquestions.org
i copied the mail subject to a file. and now the issue is to creating a directory.
now i want to create a directory without empty spaces, insted of space replace _ in that place.
i want out put like this.
Quote:
Thanks_to_linuxquestions.org
View 5 Replies
View Related
Oct 6, 2010
I am trying to encode files via mencoder. The file name has spaces in it. "test file.mkv". When I manually type the command in the terminal, everything works. But when I use a bash script (I'm reading it from a file) it doesn't. It gives me
Code:
File not found: '"test'
Below is the bash script I wrote
Code:
#!/bin/bash
# For testing, we have already built a file list, so just use that.
# ls *.mkv>files.lst
exec 10<files.lst
let count=0
while read -u 10 FILE; do
LINE="mencoder -of lavf -lavfopts format=mp4 -vf scale=1024:-3 -ovc x264 -x264encopts crf=28:vbv_maxrate=1500:nocabac:global_header:bframes=0 -oac faac -faacopts br=160:mpeg=4:object=2:raw -channels 2 -srate 48000 "$FILE" -o test.mp4"
echo $LINE
exec $LINE
done
exec 10>&-
files.lst contains only a single line (no newline) with
Code:
test file.mkv
On a related note, when I was first trying this simply on the command line, I had a file that had a double exclamation point. I found out that that is a shortcut of some kind for the previous command. My kludge to get around this was to try to execute a single exclamation point as a command, then to change the double exclamation point to a quadruple exclamation point. Is there a proper way (escape sequence or something) to pass double exclamation points to a command?
View 2 Replies
View Related
Jul 28, 2010
I want to ask a question regarding the terminal in ubuntu. When i deleted some lines in the config files for example, there will be those so-called extra spaces left after deleting and i can't seem to delete those spaces and 'pull' up the lines below. So, how to delete those extra spaces?
View 13 Replies
View Related
Mar 17, 2011
How do I access files with spaces from the command line?
for example I want to go to a file called "New File" and let's say is in Downloads/Books/(and here is the file)
how do I input the space since the command line doesn't recognize it?
View 2 Replies
View Related
Nov 22, 2010
I'm hoping that someone can help me, I need to remove spaces (not replace with underscores) from several thousand files on a system with cygwin.
Can I do this from the shell using rename or mv somehow?
View 4 Replies
View Related
Feb 2, 2010
I need to seach a string containing
the substring of 'New Request object:'
and
the substring of '/0x2ab46b1f90' in vi editor,
how do I accomplish that?
View 7 Replies
View Related
Sep 9, 2009
trying to write my thesis in Lyx 1.6. It works fine on my windows laptop at home but Not on my work computer. The problem is, when i try to view it in pdflatex it comes with with: Lyx: file name error The directory path to the document cannot contain spaces
View 1 Replies
View Related
May 11, 2011
command to find list of table spaces in oracle in unix
View 1 Replies
View Related
Jun 15, 2011
MACHINE: HP Proliant DL260G5OS: SLES 11 SP1kernel: Linux xserver 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/LinuxIt is used as remote xserver in a LAN.I have configured /usr/lib/restricted/bin/.rbashrc with some environment variables but when the users logon in the system finally is executed $HOME/.bashrc and some environment vars are overwritten.
View 2 Replies
View Related
Sep 3, 2010
I got myself a .bashrc file off the net. I checked it beforehand, didn't detect anything bad about it. One thing that's odd about it, is that several spaces are added to the terminal command line.Screenshot:Those spaces are not put there by me. The file can be found here: [URL]..
View 3 Replies
View Related
Apr 27, 2011
I would like know when it is necessary or advisable to write a shell script instead of shell function ?
View 3 Replies
View Related
Jan 18, 2011
I am wondering if I can open a shell or new terminal thing from within the terminal in a unix/linux enviroment. Particularly a commandline only one where there is no GUI. Is this doable? how do I do it?
View 3 Replies
View Related
Mar 20, 2010
Ok, so I find myself ripping audio CDs frequently, which I then lame to mp3's to put on my media player. I usually define the --ta and --tl (artist and album) ID3 tags and batch encode each album, but don't bother with the track tags as I'd have to do each one seperately.
So, I'm working on a script to do all this for me, extracting info from 'pwd' etc. to fill in the blanks for --ta, --tl and --tt (track name). All is working well, except that I can't get sed to pass on the "" character to lame to escape spaces.
Here's what I've got so far: (trouble spot is bolded - no need to pay attention to the rest of it)
Code:
All this does is pass a 'space' on to lame, which it takes as an invalid argument.
View 10 Replies
View Related
May 17, 2010
When i use my computer (whether it's going online, typing, playing a flash game, or coding) I get these "Black Flashes" that are becoming longer and more frequent. A "Black Flash" is when my computer screen turns blank (but you can still see the backlight) and i have to press the NUMpad ENTER button, shake my mouse furiously, or click my mouse, which sometimes causes undesired actions, but gets me my screen back. sometimes the Black Flashes last a milisecond or 5 seconds or i have to hold the power button and restart because it won't come back on.
Specs:
Toshiba P205-S6337 Laptop
Ubuntu Karmic Koala
2.39 GB of RAM
[Code].....
View 9 Replies
View Related
May 19, 2011
I have want to list sub-directories with spaces but am facing the following problem:
My subdirectories are:
FirstDirectory
Directory with spaces
if I use
Code:
for directory in "`find . -type d`"
[Code]...
View 5 Replies
View Related
Aug 10, 2010
(It just quietly fails so I'm left wondering like in Windoze "is it hanging?") On the taskbar, next to my computer icon I inserted a drawer. I was hoping to put in my Favorite Applications (wine apps don't seem to get inputed to opensuse's recent list.
What I've tried is: (all to no avail, also note: I've been inputing this in Add To Drawer- Custom Application Launcher.) Also, note the directory location is valid as well, it's how I did it in my windoze installation.
Code:
"wine c: Program FilesWoWWow.exe"
wine "c: Program FilesWoWWow.exe"
wine c:\ Program Files\WoW\Wow.exe
wine c: Program FilesWoWWow.exe
View 3 Replies
View Related
Nov 7, 2010
I got a few Ubuntu versions on different partitions and a few 10G swap spaces on my 1TB disc. Is it possible to delete some of these swap spaces and just keep one? Will any of them do the job for all Ubuntu versions?
View 1 Replies
View Related
Aug 6, 2011
I have strange issue with ubuntu's terminal lately it's showing up a space after some letters such as " t l f j i " when I tried to write a command by any of these letters I have got it, this problem is preventing me to implement any correct command so is it pkg issue need to re-install or I have to do something ?my OS is ubuntu 11.04 natty with gnome unity GUI/ UTF-8 | all my fonts that are using on my machine is Arial.
View 9 Replies
View Related