Which do you prefer and why? Also, I remember someone telling me once that while using space indentation use either 4 spaces or 2 spaces. Don't use 3 spaces. Anyone know why they would say not to use 3 spaces?
I writing a script to go through multiple reports. I want to grep daemon.debug @10.10.10.10 on all reports to make sure it is pointing to the right IP address. the problems is the space between debug and @10 are different on all the reports, some have one space some have two and some have tabs how do I ignore the tabs or spaces and grep daemon.debug @10.10.10.10
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?
Iam reading a file using C-sh script after manipulating the variables I need to dump into a new file. This in working fine but I couldn't retain the multiple spaces and tabs in a same line. For readability I want to print it back as I read. Now script treating multiple tabs as onl tab or space.
Firefox is sometimes slow opening new tabs/switching between tabs. If I click on the kickoff application launcher button, it takes a few seconds to open, and typing something in the search makes it hang up for about 20 seconds before it does the search. Clicking on an app takes 16 seconds before the menu window closes and the program begins to start. Then it takes another 30sec-1min before the app is usable. smplayer plays video with tearing.
Like right now I tried taking a screenshot, and it tells me
Error launching /usr/share/applications/kde4/ksnapshot.desktop. Either KLauncher is not running anymore, or it failed to start the application.
while the app worked fine.
I also tried running glxgears right now, and it runs but the gears don't move, and terminal states
15 frames in 19.0 seconds = 0.789 FPS XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0.0" after 48 requests (48 known processed) with 15 events remaining.
If I'm on dolphin, and I click a video to start smplayer, it takes about 1 minute for it to start.
Memory is using 1.4GB out of 3.6GB, with 0.08GB/2GB swap
Top shows an average usage of less than 10% average. Xorg is always 25%, kwin is always 10% and then rest of the apps are less than that.
CPU: AMD Athlon(tm) II X4 620 Processor Integrated VIdeo: HD4200 with fglrx driver
When I ssh into the computer with x tunneling, the programs start up faster than being on the desktop
want to set more text files. They have "tab" differently (3, 4, 6 or 5 characters space).I have to use "sed" or "awk" sette them in the same tab (for example five space haracters).
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.
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.
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.
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.
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
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.
I'm writing something which takes user input (which may or may not contain spaces...) and then runs a command on a remote system via ssh. However the remote command does not work. I can't print the exact code so I'll just provide an equivelenat problem. This needs to work with filenames which do and do not contain spaces.
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"
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
I have a fresh dedicated server that im currently configuring and needed a little help if I may ask.The problem is that i'm having a file naming issue. for example from the web I can access any file that does not have spaces of any type. ex/music/musicfile.mp3this works fine and my php script can locate itBut the problem is when I try to access a file that has spaces.ex/music/The Eagles - Hotel California.mp3my php script can't seem to locate any files like this with spaces but doesn't have a problem locating the files with no spaces.
I also took a look at the directory within shell. I did notice that files that have spaces are showing up in this formatt in shell.#/home/~username/public_html/music/The Eagles - Hotel California.mp3In shell , i'm assuming that unix/linux maybe adds a backslash before spaces. But when I FTP to this same directoy, the filename look normal and at windows standard. how could I correctly access these types of files within my php scrits? or would I need to have all uploaded files renamed so that spaces are replaced with underscores maybe?
I'm trying to insert a line using sed that has leading spaces before the text. Sed seems to be just dropping the spaces and only inserting the text. Any ideas what I'm missing?
Code:
NAM=rb134 sed -i.bak -e "$i host ${NAM} {" /etc/crap
Instead of inserting a line with 8 leading spaces inserts it with "host" at the beginning of the line. I tried
Code:
NAM=rb134 sed -i.bak -e "$i ^ host ${NAM} {" /etc/crap
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
I often get files with many spaces as part of their names. I would like to automatically replace these spaces with underscores, but otherwise not change the file name. Is there a way to do this task with just the bash shell?
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:
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)
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?
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:
Does any one know what syntax i could use to allow me to replace all instances at the beginning of a line with ones.
Before :
Code: ---------------------------------------------------------------------- Logical device information ---------------------------------------------------------------------- Logical device number 0 Logical device name : RAID1Mirror RAID level : 1 Status of logical device : Optimal
After
Code: ---------------------------------------------------------------------- Logical device information ---------------------------------------------------------------------- Logical device number 0 111Logical device name : RAID1Mirror 1111RAID level : 1 11111Status of logical device : Optimal
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?
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
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.