Programming :: Replacing The Last Digit?
Jun 23, 2010
i am trying to replace the last digit in the ip address(25) with 47 using following:Quote:echo 192.168.0.25|sed -r s/([0-9]*.[0-9]*.[0-9]*)/47/g'but not able so far, was wondering if you can help, so i can find my mistake.
View 6 Replies
ADVERTISEMENT
Jul 8, 2010
Before i want to buy (OLD) Sek'd Prodif plus soundcard, i want to know, this card is working with Ubuntu 10.04?I found some information in the Alsa page, but i just shaw digit i/o, and i don't need digit i/o, just ANALOG I/O.Somebody can tell me about this card?I really need any information about driver (alsa or oss)
View 1 Replies
View Related
Dec 28, 2009
I have a new computer on which I have installed suse11. My old computer has suse10. I have copied all my files to move to the new machine and I have the same username on both systems but the uid on my old one is 501 and on the new one it is 1001. know this is going to cause trouble
View 1 Replies
View Related
Nov 24, 2010
I have a file that contains something like this:Quote:
HOURS FROM-TO
------------------------------------
4 10.00-14.00
8 8.00-16.00
10 10.00-20.00
Now, i need to get only the first column, i know how to do that awk '{print $1}', but how can i make an operation with all these numbers? (8+4+10...)
View 3 Replies
View Related
Dec 15, 2010
I'm trying to convert an 8 digit string into a long. The code compiles, but I'm getting only 1 digit placed into the long.
[Code]....
View 2 Replies
View Related
Jul 4, 2010
I want to print a single digit integer on to the screen using the int 0x80. I have loaded the number in the ecx(=5, say), size in edx (=4, lenght) and eax (=4) ebx (=1). I've added 48 to the contents of ecx, and then calling int 0x80, I thought should print 5 on the screen.
However it does not print anything. also gives no errors. I checked the contents of the ecx reg (gdb), it has 53.
A snippet showing the this will be great. I've seen snippets using the c library (printf), but I want to see how it is done using int 0x80.
View 9 Replies
View Related
Aug 9, 2010
I just started learning shell programming and I'm trying to create a shell script that produce something like this:
Input: 1 234 5 678 9
Output: < <<< 5 >>> >
Input:abc d 1234 5 5 67890 e f ghij
Output:abc d <<<< 5 5 >>>< e f ghij
Characters with values less than 5 will display '<' digit values greater than 5 display '>'. The digit '5' will be left unchanged.
Below is my unfinished code:
#!/bin/sh
read userInput
for f in "$userInput"
do
f1="$(echo ${f} | sed "s/[^0-9]//g")"
if test $f1 -lt 4
then
f3='<'
elif test $f1 -gt 6
then
f3='>'
fi
f2="$(echo ${f} | tr "$f1" "$f3")"
echo $f2
done
View 12 Replies
View Related
Jan 19, 2010
i have a string of information displayed in this way :
Code:
John:king:20:34:60
what i am tring to do is to read in input which is given by the user and change it to the
[code]....
View 3 Replies
View Related
Nov 28, 2009
I'm writing a script to replace some text that exists in about 50 .lex, .y, and .cc source code files, sometimes more than once in a file. Sometimes the text is in a multiline C comment, and other times it's within a multiline C string.
I use sed to grab the start and end of each line and wrap the new text in the old whitespace and/or quotes and Problem is, sed is changing the characters into a newline.
Is there a way to tell sed to not process escape sequences? I tried using several variations of
Code:
To no avail. Or could it be bash?
I would give up on the script and do it by hand, but this is something that I must do from time to time.
Here's the function which replaces the first occurrence found:
Code:
When $post is printed by echo, it shows the - but by the time the file is on disk, it becomes a newline. What should I do to ensure that it stays as the characters ?
View 4 Replies
View Related
Jun 16, 2010
Okay, so I have a .txt file, LL.txt; here is its contents:
Code:
/mnt/sda1/Music/Lydia Lunch/Honeymoon In Red
/mnt/sda1/Music/Lydia Lunch/Honeymoon In Red
[code]....
View 9 Replies
View Related
Dec 29, 2010
I would like to replace 'xxxx' with 'yyyy' which is in a file xyz.csproj not sure of what 'xxxx' is, it can be 3055, 4056, 7089 etc. I know it always appears at line # 5 and at character 50.
<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Windows.Forms" />
[code]....
View 14 Replies
View Related
May 25, 2010
I have lines in some files that look exactly as below, and the line numbers they occur in are always the same. (Lines 136-139)
W 0.00000000 0.00000000 2.00000000
W 0.50000000 0.50000000 2.50000000
W 0.00000000 0.00000000 3.00000000
[code]...
View 1 Replies
View Related
Dec 10, 2010
Been at this all morning and fail on every attempt.
I have a file called sitemapindex.xml
Its contents just are names of the other sitemaps. Google gets pissy because it isn't in a http:// format.
So, I need "<loc>sitemap-c1mediawiki-............</loc>" to be replaced with "<loc>http://domain.tld/sitemap-c1mediawiki-............</loc>".
Here's the expression I've been trying:
find /path/to/site/sitemap-index-c1mediawiki* -type f | xargs sed -i 's/[<loc>sitemap]/[<loc>http://domain.tld/]/'
It fails.
I've tried with and without brackets.
View 4 Replies
View Related
Apr 12, 2010
I have two files, where the 1. file has special lines that need to be updated by lines from a 2. file:file1:
foo
foo
foo 0.00 0.00 0.00 pattern
[code]....
View 1 Replies
View Related
Nov 9, 2010
I have a text file that needs to be updated to be used by some fortran code later. it looks like that:
1,1 !Ms for y-stations, Ns for x-stations
0,0,0, !xsta, ysta, zsta
I need to replace the "0,0,0" with new values for xsta,ysta and zsta;
View 4 Replies
View Related
Jul 21, 2010
working on a script to update .Jar file, I have tried jar xf to unpack and jar cf to repack it is giving me java.lang.NoClassDefFoundError exception at main class. I also tried jar uf, which is also not working for me Basically my jar file requires to update date, which i do from "winrar" Manual it works fine, but now to remove "Donkey work", i want to make an script which does this all automatically, and the last stage is to update jar file which is not happening.
View 1 Replies
View Related
Jun 9, 2011
I'm staying in a new flat and the landlord told me the widow has a four digit pin. The network shows up as WPAA/WPA2 personal. When I go to enter the pin, 4 digits isn't enough to let me try to connect. She swears that's the passcode
View 1 Replies
View Related
Sep 29, 2010
Suppose I have a file named temp.txt
cat temp.txt
word/one/two/three
If I would like to replace "one" with "six" I would do this:
cat temp.txt | sed 's/one/six/'
word/six/two/three
Now I want to replace "one/two" with "six/seven" and these options don't work:
cat temp.txt | sed 's/one/two/six/seven/' (OFCOURSE)
cat temp.txt | sed 's/"one/two"/"six/seven"/'
I even want to be able to replace "one/two" with "six/seven/eight"
View 6 Replies
View Related
Jan 2, 2011
I have been running Ubuntu 10.10 and have found that at any time I am connected to the Internet that I will randomly see high port numbers open when doing a port scan on my computer all are in the unknown listings with five digit numbers so I don't know what is going on or who is using them. Please check your system to see if you are having the same thing happen by using network tools and filling in your local ip address in the port scan tab. If you shut down your Ethernet interface and run port scans the high ports are no longer open. this will at least keep whoever is using your ports at bay when you are not using the net.
View 4 Replies
View Related
Jun 24, 2011
in terminal: if var = 2 and we write the file name "name$i" it would be "name2" but my file name is "name02" (in fact I wanna have a 'for' loop on about 50 files named: a01, a02, ... , a50)
is there any way to make a 2(n) digit number with additional zero(s) like "%02d" in C ?
View 4 Replies
View Related
Sep 9, 2010
Is it possible to point to a two-digit interval with regular expressions?
Background:
I'm using mplayer to watch tv shows, that often have episode numbers in their names. I know how to easily add several files to the playlist by using brackets, by typing something like
$ mplayer tv/South.Park.S1.E0[1-5]*avi
Is there a way to point to files 06-13 in a single expression?
View 2 Replies
View Related
Nov 23, 2010
I just want to grep for a n digit number followed by M alphabet. Generally for a three digit number i can give grep [0-9][0-9][0-9]M , but if the digits are increasing it is tough to represent them.
View 7 Replies
View Related
May 21, 2010
I've noticed a bit of a problem here in the last few days...after some point, my numeric keypad stops being a numeric keypad; instead, it controls the mouse (5 right clicks, and the outer keys move the cursor in the appropriate direction). It doesn't appear to happen on boot, as I generally type the numeric bits of my password with the keypad, but some point after. The only common events I can think of where this has occurred is either after connecting to the system via SSH, or after swapping to tty1 (which usually requires re-enabling of numberlock for the terminal to recognize digits, again for the password). No matter what state the NumLock is in (off or on) at this point, the keypad fails to function as a keypad.
View 2 Replies
View Related
Mar 22, 2011
I have two files, file1.traj and file2.traj. Both these files contain identical data and the data are arranged in same format in them. The first line of both files is a comment.
At line 7843 of both files there is a cartesian coordinate X, Y and Z ( three digits ). And at line 15685 there is another three digits. The number of lines in between two cartesian coordinates are 7841. And there are few hundreds of thousands of lines in a file.
What I need to do is copy the X Y Z coordinate (three digits) from file1.traj at line 7843 and paste into file2.traj at the same line number as in file1.traj. The next line will be 15685 from file1.traj and replace at line 15685 at file2.traj. And I dont want other lines (data) in file2.traj get altered. This sequence shall be going on until the end of the file. Means copy and substitude the selected lines from file1.traj into file2.traj.
I tried to use paste command but I cant do for specified line alone.
Here i showed the data format in the file. I used the line number for clarity purpose.
Code:
View 10 Replies
View Related
Jan 7, 2011
Usually if I have to replace a character in a string I used the sed /s/ command. However, I am having some difficulty in doing the same thing when I have the following string in a variable in my shell script and I need to replace all the forward slashes ("/") to backslashes ("").
For example, this is what I am doing:
Code:
Not sure how to escape the slashes in this case.
View 2 Replies
View Related
Jul 16, 2010
I want the output of this file to be in a column, not next to each ohter. I tired putting a a newline escape character in a few places, but it breaks the script. It is easy in awk, just ls -ltr | awk '{print $8 }'
casper@casper-laptop:~$ pwd
/home/casper
casper@casper-laptop:~$ ls -ltr > /tmp/outfile
casper@casper-laptop:~$ cat -n /tmp/moreawkreplace
1#!/usr/bin/perl
[Code].....
View 1 Replies
View Related
Apr 13, 2011
I'm trying to go from LILO to GRUB (legacy). However, when I try to "sudo grub-install /dev/sdb", I get: [URL]
View 1 Replies
View Related
May 3, 2009
I have a dual boot configuration now, Windows XP SP3 on the C drive (sda,1 it's a Dell Dimension 4700) and FC 6 on sdb. My goal is to install 10 and be able after installation to boot to either XP or 10. Some of the installation documentation baffles me, so I want clarification before I begin. 1st Question Looking at the screen shots of an installation on the fedora site, the Partition Selection Screen asks What drive would you like to boot this installation from?
Booting an installation? Maybe this meansFrom what drive are you installing? Once 10 is installed, what drive should be the boot drive? From what drive should I boot to install? Would somebody explain the intent of this Partition Screen question? BTW, I will be installing from CDs. 2nd Question: Upgrading Boot Loader I don't understand the Installation Guide, section 8.3 on upgrading vs skipping. I think I got into trouble on this very point going from FC3 to FC6. The boot loader on my Dell must be grub. So, I think I want to upgrade. Perhaps the confusion is that I'm replacing FC6, not upgrading, and upgrade here means only for grub, not for the install.
View 3 Replies
View Related
Jul 4, 2010
I know that this topic has been posted, responded to, and maybe even resolved, many times here, but I am stuck here with partially dead fileserver and need some pointers.
Problem: one disk drive that was part of a logical volume died. I have a replacement, but I can't get it into the LV and get the LV back up again.
pvcreate --uuid <uuid of dead drive> /dev/sdX1, where /dev/sdX1 is the newly created drive and its partition.
vgcfgrestore VolGroup
vgscan VolGroup
vgchange -ay VolGroup
e2fsck /dev/mapper/VolGroup-LogVol
but, e2fsck can't find a superblock. Apparently this drive is the first in the LV sequence, and it is not formatted as part of the LV.
So how to I get this new disk formatted into the LV without reformatting the entire LV and losing what data I still have?
(FWIW: this is on F11)
View 2 Replies
View Related
Sep 9, 2010
I have recently purchased an MSI U100 Netbook with SLED10 & upgraded to SP1. I have had a number of issues trying to upgrade to SP2. So many I had to go back to factory settings & re-upgrade to SP1! I spend several hours daily trying to resolve basic usability issues with internet and multimedia. This is not how I wish to spend the next 12 months traveling with the Netbook. I am at a point where I am about to take the easy option, ditch SLED & install Windows XP OS on the Netbook. I would rather stick with the Linux base if i can.Is it possible for me to download OPENSuse 11 on the SLED 10.1 OS without and dependency conflicts?
Is it advisable? Will many of my multimedia issues disappear [I can't even upload .jpeg, .avi or .mov files from my camera to my blog and my generic MP3 player is not recognised even as a mass storage device ] Would I have to completely uninstall SLED to install OpenSuse or are they compatible? If I have to uninstall how?!
View 9 Replies
View Related