General :: Bash Command To Remove Spaces

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


ADVERTISEMENT

Ubuntu :: Command To Remove Spaces From Filenames?

Aug 18, 2010

I have just switched to banshee as my media player and imported my films and music. Problem is, the video list is quite hard to read because all the video files have spaces in their names which are replaced by % signs, numbers and letters. I'm wondering if there is a command I can use in the directory that will automatically remove all the spaces from the filenames or better still, replace the spaces with hyphens or underscores?

View 6 Replies View Related

Programming :: Unix Command To Remove White Spaces?

Sep 18, 2010

Im using this unix command(in a php file) to remove a certain string and then remove the whitespace left by that string. Unofrtunately in many cases, the files get completely erased. Is there a workaround?

Code

<?php
$dir = "./";
$rmcode = `find $dir -name "*.php"

[cod3e]....

View 14 Replies View Related

Ubuntu :: Remove All Foldernames Which Contains Spaces In Desktop With A Single Command?

Jun 8, 2011

How to remove all foldernames which contains spaces in Desktop with a single command?

View 7 Replies View Related

General :: Bash Command Needed To Remove Failed Install?

May 11, 2010

An app failed to load properly and now i'm stuck in a sequence I don;t understand the solution for.

sudo apt-get autoremove

dpkg was interupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

View 1 Replies View Related

General :: Remove Spaces From Many File Names Under Cygwin?

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

General :: Selectively Remove Blank Spaces From String?

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

General :: Bash - Rename Files With Spaces Using System Shell?

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

General :: Running SCP Command With Spaces?

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

General :: Spaces In Command Line Switches

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

General :: Access Files With Spaces From Command Line?

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

Programming :: Bash Command To Remove All Files Within A Specific Folder?

Oct 19, 2010

I want to delete all files within a specific folder without actually deleting the folder, what is a good bash command for this?. I found this one but encountered some errors even though I am executing it within the specific folder:

useratdebian:/home/user/folder# find . -type f -exec rm -rf {} ;
[1] 5052
useratdebian:/home/user/folder# find: missing argument to `-exec'
[1]+ Exit 1 find . -type f -exec rm -rf

The command as it appears is:

find . -type f -exec rm -rf {} ;

how to delete only the files contained within the folder called "folder" for example?

View 4 Replies View Related

General :: Shell - Rename A File From Something Without Spaces To Something Containing Spaces?

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

General :: Bash Scripting - Sed - Lame - Character To Lame To Escape Spaces

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

Programming :: Bash File Names With Spaces?

Jul 24, 2010

I have a laptop that I am in through SSH. The laptop does not have an Xwindow system so I am using the program fbi to open an image on my laptop screen from my SSH connection:

fbi -T 8 picture.jpg #this opens the image on the laptops tty8 terminal

I've found that making a for loop does not work with files that contain a space in the name. Something to due with a bug that they call a "feature" that stops the first variable at the first whitespace.

Using a "while" loop is not exactly what i require either seeing as I want to be able to view each image in the directory on screen and tag it accordingly, before it jumps off to the next image, and I'm not sure how to add a pause to a while loop.

How do I make a Bash script and loop Variables handle files like "files that contain spaces.jpg"

View 5 Replies View Related

Programming :: Bash Script And Filename Spaces ?

Jan 15, 2010

I have over 50 files names with spaces in them.

I'm trying to use a for loop as such:

However, when I print the $filename in the script, the script prints out parts of the filename because of the spaces in the file name.

For example, say the file name was Star Quest.php

When the script executes one $filename would be Star and another Quest.php.

How could I account for this? Something like $'filename'

View 13 Replies View Related

Programming :: Using Sed To Remove Preceding And Trailing Spaces In CSV?

Sep 16, 2010

the preceding and trailing spaces around the commas in my CSV without destroying my address field. I'm new to regex and sed so this is probably easy but I just can't do it without destroying the Address section. I'm using vanilla Linux and sed 4.1.3I'm willing to use any regex or even awk if needed.

Example:
I need this
randall , dean, 11111 , 1309 Hillside Ave., Warsaw, VA , 23591

[code]....

View 11 Replies View Related

General :: Write A Literal Bash Command In A Bash File?

Nov 29, 2010

I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:

Code:
#!/bin/bash
cat > ~/generateGridmix2data.sh << END

[code]...

View 6 Replies View Related

Debian :: BASH Scripting - How To Use Variables With Filename Spaces

Jun 25, 2015

I am trying to create scripts to move files over from one directory to an ftp server and there is this one file with spaces that bash is see each word as being a file, here is the variable i am trying to use:

Code: Select allLOCL = '/mnt/cifs/"File name with spaces"/'
cd  $LOCL
ls -l

View 3 Replies View Related

Programming :: BASH Script: Spaces Are Getting Converted To TAB Character?

Dec 23, 2010

I have a BASH shell script with embedded SQL script. The SQL script fetches the data from oracle server and the data contains more than 8 spaces in the value (eg, 28051630 A) and the data is written to flat file using the below syntax:

$ORACLE_HOME/bin/sqlplus -s ${CONNECT_STRING} >${out_file} <<!!
.. sql query..
!!

The problem is that whenever the data is written to ${out_file} spaces are getting converted to TAB character

eg, 10 spaces (in Oracle) converted to 1 TAB and 2 spaces 7 spaces (in Oracle) converted to 1 TAB and 1 space Also, from above example you can see the width of TAB char is not constant (8 in first example and 6 in second example) Is there any way that I can stop shell script to convert spaces into TAB character as I want the data as it is from Oracle DB (i.e. only spaces not TABs)

View 3 Replies View Related

Programming :: Handle Files With Spaces In Their Names In Bash?

Apr 1, 2011

*I'm using Ubuntu 10.10

My issue is I can't handle the files with spaces in their name, I've donde the below script to print each file found inside folder and subbfolders with "find".

I would like to "ls" to each file found with its complete path and with its basename too.

Code:
files=$(find . -type f)
for each in "$files"
do
ls -l "$each" # 1rst option I've tried to list with full path
ls -l "$(/bin/echo "$each")" # 2nd option I've tried to list with full path
ls -l "$(/bin/echo $(basename "$each"))" # 1nd option I've tried to list with it basename

[Code].....

How can I list "ls -l" in both cases (with full path and with basename) when there are files with spaces in their name?

View 6 Replies View Related

Ubuntu :: Remove All Double Or More Spaces From A Group Of Words?

Mar 7, 2010

How could someone remove all double or more spaces from a group of words? Is there a GUI program or CLI method or both? Example: I like to turn this:

[Code]...

View 2 Replies View Related

Programming :: Bash - How To Expand Path Variable That Contains Spaces And Wildcards

Feb 15, 2010

having bit of a trouble with path expansion of strings that contain some whitespace and wildcards First my script sources a configuration file that contains array assignments

Code:

...
BACKUP_TARGET_FILES[2]=/boot/config-* # no problems
BACKUP_TARGET_FILES[3]="/root/random dir with space/file*" # this is the problem
...

then later in the script I want to expand BACKUP_TARGET_FILES elements as below

Code:

IFS_DEFAULT="$IFS"
shopt -s nullglob
shopt -s dotglob
IFS=

[code]....

this code seems to work but I'm not quite satisfied with it. I'd like to get rid those IFS changes, but haven't found out a solution as of yet. Problem with default IFS seems to be that with it neither $pattern or "$pattern" work; it either interprets pattern as multiple words (because of spaces) and so expands to wrong paths or it ignores * because it's within quotes.

View 11 Replies View Related

Programming :: Auto_extract.sh Bash Script - Does Not Work With Any Paths That Contain Spaces

Jan 25, 2011

Have worked with Linux at home for some time and have wrote the below script.

This script is run when a .torrent file finishes downloading and extracts any .rar files into an extracted directory.

However there are 2 thing that i cannot for the life of me get working.

These are:

1. I need the script to check a txt file to see if the file has been extracted previously.

2. The script does not work with any paths that contain spaces.

Code:

View 11 Replies View Related

General :: Bash Command History Update Before Execution Of Command

Jun 7, 2010

Bash's command history is great, especially it is useful when adding the history -a command to the COMMAND_PROMPT.However, I'm wondering if there is a way to log the commands to a file as soon as the Return key is pressed, e.g. before starting the command and not on completion of the command (using the COMMAND_PROMPT option would save the command once the prompt is there again).

I read about auditing programs like snoopy and session recorder like script but I thought they're already too complex for the simple question I have. I guess that deactivating that script logs all the output of the command would lead already in the right direction but isn't there a quicker way to solve that probelm?

View 1 Replies View Related

General :: What Does This Cryptic Bash Command Mean - Why Command Crashes

Mar 20, 2011

Possible Duplicate: What does this cryptic bash command mean? Why this command crashes Linux? :(){ :|:& };:

View 4 Replies View Related

General :: Command To Delete Bash Command History?

May 31, 2010

What's the command to delete bash command history?

View 4 Replies View Related

Software :: MV Command With Files Name Include Spaces

Oct 3, 2010

One system send files to linux machine and it is name contains spaces and I tried to move it from one directory to other, but it show error:
Ex:-
mv -f file one file two
mv: target 'one' is not a directory

View 6 Replies View Related

Software :: Bash - Indirect Array Reference To Array With Values Containing Spaces?

Jun 4, 2010

This _almost_ works. I just can't quite get it to honor the spaces.

Code:

#!/bin/bash
profiles=(
PROFILE_ONE
)
PROFILE_ONE=(setting1 "setting number 2")

[code].....

View 9 Replies View Related

General :: Create A Bash Script To Remove All Partitions On Harddrive Via Fdisk?

Jul 19, 2010

I would like to remove/create partitions on a harddrive without going into the menu of fdisk.

can one pass options to fdisk to create and delete without going into the menu? So that I can write a script to do that automatically.

Or if fdisk isn't capable, what other alternatives do I have?

View 5 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved