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


ADVERTISEMENT

Programming :: Reading And Writing White Spaces To A File?

Dec 2, 2010

I am trying to read a file character wise and trying to write the same character to another file. In this process, I unable to read and write white spaces successfully to the new file. The script reads the white spaces but while writing the white space is lost. The section of the code, is given below. Please advice how can i read and retain the white space while writing to a new file.

Code:

if [ -s f_test.txt ] && [ -f f_test.txt ]; then
echo "File Exists !!"
while read -n1 char; do

[code]....

View 2 Replies View Related

Programming :: If Statement Regex Match For White Spaces?

Apr 8, 2011

I want to match for this string:

Code:

Content-Transfer-Encoding:[:space:]base64
Content-Disposition:[:space:]attachment;[:space:]filename="%variable%"

Both lines are new lines, so they won't be inline. Other than that, they are all constants, I want this regex match to be an if statement rather than returning match string. so if the $content variable contains some string that matches:

Code:

if `sed "//p"` ;

View 4 Replies View Related

Debian :: Delete Back Over White Spaces They Stay White Out?

Oct 10, 2010

here is what is in my file:

[code]...

i have xterminus installed. i also have a white block over the first letter in my username and when i begin typing, the 'block-type cursor' just leaves full white spaces behind and i cannot read my text at all. even when i delete back over the white spaces, they stay whited out.

View 4 Replies View Related

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

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

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

Programming :: Remove White Space, +, And -, By Awk

May 18, 2011

I have some data whose no certain pattern. Below is as an example.

20110101 1+1-0 1-1 1+1-2 8- 5 3 0 3 4 5 3 7 4
20110102 1+2-0+1-1-1+2-1+ 9 5 6 2 3 3 5 6 5 4
20110103 1-1-0+1 1 2 2 2+10 3 3 2 4 4 7 7 9 5
20110104 1+3-1 1 1+2-2-1-11+ 5 12 4 4 5 6 6 3 6
20110105 0 0 0 1-1-1-1+1 4+ 0 0 0 3 3 3 5 4 2
20110106 1+0+0 0+0+1 2 4+10- 5 2 0 2 2 4 7 32 7

I want to remove space, + and - mark so that I can get the below such data :

20110101 1 1 0 1 1 1 1 2 8 5 3 0 3 4 5 3 7 4
20110102 1 2 0 1 1 1 2 1 9 5 6 2 3 3 5 6 5 4
20110103 1 1 0 1 1 2 2 2 10 3 3 2 4 4 7 7 9 5
20110104 1 3 1 1 1 2 2 1 11 5 12 4 4 5 6 6 3 6
20110105 0 0 0 1 1 1 1 1 4 0 0 0 3 3 3 5 4 2
20110106 1 0 0 0 0 1 2 4 10 5 2 0 2 2 4 7 32 7

Is it possible by using awk?

View 7 Replies View Related

General :: Find List Of Table Spaces In Oracle In Unix?

May 11, 2011

command to find list of table spaces in oracle in unix

View 1 Replies View Related

Programming :: SORT Command Versus Unix SORT

May 4, 2010

We switched from unix to linux and we have an old report that extracted data from a database, output to an ascii file and then sorted the results in the file based on different arguments. The report now blows up when it runs,and I can only guess it is because the options for sort on linux differ slightly from unix.For example, here is one of the commands issued from within the report app that ran on the old unix box:

if sort-sequence = "descending" then
'sort -t~" -f +3.0f -4.0 +5.0r -6.0 -f '
else
'sort -t~" +3.0f -4.0 +1.0f -2.0 -f'

I will eventually rewrite the report to store the data in a local table, but I can simply adjust the options to suit the requirments of linux. Basically, I need to know if this can be a quick fix for the short term.

View 2 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

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

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

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

General :: Get The MAC Address From Windows Xp And Remove It From A File On A Unix Box?

Mar 13, 2011

I am tring to get the MAC address from windows xp and remove it from a file on a unix box. This is what I have so far:

getmac | plink.exe -ssh -pw "my pw" -noagent -m commands.txt root@192.168.1.82
commands.txt
cd /root
tr '-' ':' | tr -d '[:blank:]'

now this is what I get

10:9A:CD:5F:04:8ADeviceTcpip_{5A79FE8D:F227:4B91:9459:2701486C5D94}

All I need is the MAC. Everything after Device* is not needed.The file is /var/db/captiveportal_mac.db. The MAC address are listed like this.

MAC1
MAC2
MAC3
MAC4
MAC5

View 11 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

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

Fedora :: Remove White Bar At Top While Using Firefox (or Any Other Window)

Aug 24, 2011

For the life of me I cant remember what this bar is called, but if you right click, it allows you to close the window, minimize or maximize it, etc.

I like black themes, and right now everything but that bar is black.

Is there any way to change that bar from white to black?

View 1 Replies View Related

Ubuntu :: Remove White Border From Thumbnails?

Jun 27, 2010

is there a way to remove this eyesore, this wasn't the case in Karmic.

View 1 Replies View Related

Programming :: Unix Programming - Single Thread Server Can Support Exactly 2 Clients At Once

Sep 28, 2010

A simple TCP based chat server could allow users to use any TCP client (telnet, for example) to communicate with each other. For this question you should consider a single process, single thread server that can support exactly 2 clients at once, the server simply forwards whatever is sent from one client to the other (in both directions). Your server must not insist on any specific ordering of messages as soon as something is sent from one client it is immediately forwarded to the other client. As soon as either client terminates the connection the server can exit

View 4 Replies View Related

Programming :: Unix Programming - Single Process That Does Not Start Up Any Other Threads

Sep 28, 2010

i want a process that can operate as both a TCP echo server and a UDP echo server. The process can provide service to many clients at the same time, but involves a single process that does not start up any other threads.

View 3 Replies View Related

Programming :: Missing Separator Mean Tab Instead Of Spaces?

Jul 9, 2010

I am unable to write a simple Makefile. Though I know the concept am facing this error:
Makefile:2: *** missing separator (did you mean TAB instead of 8 spaces?). Stop.
Should I give a tab or spaces not able to continue.

View 5 Replies View Related

Programming :: C++ Won't Detect Spaces In A String?

Oct 8, 2010

I have been trying to code a program in C++ that must check for the correct syntax in order to operate. It must find ", " within the string, but I don't know why the compiler won't recognizes spaces.

Code:
#include <iostream>
#include <stdio.h>
#include <string>

[Code]....

So the user must input "<name>, <interest>" with the ", " (comma and space) but even if you respect the syntax the compiler will skip to the else condition. I don't know why, but if I put any other condition like ",s" it will work, but not with spaces.

View 7 Replies View Related

Programming :: The 'a' String Doesn't Have Any Spaces In It?

Nov 27, 2010

I have a file of the type:

a = b

where a is any string and b is an integer The 'a' string doesn't have any spaces in it.

Everything was running fine till I was searching for 'a' and finding value 'b' by expression

Code:
string="$a"
egrep -i -m1 "^[[:space:]]$string[[:space:]]*=" | awk -F'=' 'gsub(/^[[:space:]]+/,"",$2)gsub(/[[:space:]]+$/,"",$2){print $2}'

I recently ran into a situation where in the string 'a' had symbols like $, & in it. Though I haven't checked it for & but $ is definitely breaking my code

Any way to egrep for string with $ ??

One way I though was to replace every occurence of $ with $ in my search expression but that would involve an extra processing each time

View 10 Replies View Related

Programming :: Python - How To Avoid Spaces

Oct 1, 2010

In the code below:

Code:

The output is:

Code:

Looks like the "," operator in the print inside the loop is adding a space for its own.

I want to print the sequence WITHOUT spaces. Something like this:

Code:

But I couldn't figure out how to do this.....

How to print a sequence, inside a loop, without that space ?

View 14 Replies View Related

Programming :: Pad End Of Each Line With Spaces To = 80 Chars?

Apr 14, 2011

I've searched the forums and the google looking for a means to do this and haven't found anything I can use. I have a large file that looks like this:

Code:

18000034161828M850
18000034172676M850
98 093095

[code]...

I need to add spaces at the end of each line to ensure that every line has 80 chars before the carriage return. I was thinking something like this, but it doesn't do the right thing:

Code:

cat filename | sed -e 's/$/(bunch of spaces)/' | cut -c1-80 > filename2

I'm on fedora, so I can use awk, sed, bash, ksh, etc.

View 14 Replies View Related







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