Programming :: Command Replaces "abb" Substring?
Oct 6, 2010Here's my question. This command replaces "abb" substring
Code:
echo abbc | sed "s/.*b//g"
And this command doesn't work (lazy regex):
[code]....
Here's my question. This command replaces "abb" substring
Code:
echo abbc | sed "s/.*b//g"
And this command doesn't work (lazy regex):
[code]....
want to know if Ubuntu provides a command to search for a command having a specific word.e.g.If I know a command contains editor as a substring but don't know exactly what the command is,then is there a way to find that command or the list of commands having editor as a substring.
View 1 Replies View RelatedI want normal substring of a string that actually is a url as follows
SITEURL/main.php?page=122&type=download_file&fileID=9&user Id=user1&org=org1&mainmenu=main1&submenu=sub1
What I want is a substring like below
org1_user1_main1_sub1
I have the following string:"My dog spot(page 1)". I want just "My dog spot". How do I do this in SQL Server?
View 2 Replies View RelatedI've spent most of the evening browsing the web, trying many things I've found on various forums, but nothing seems to work.
I have a test.txt file containing many lines like the following ones :
...
<insert_random_text>228.00 €<insert_more_random_text>
<insert_random_text>17.50 €<insert_more_random_text>
<insert_random_text>1238.13 €<insert_more_random_text>
...
And I want to extract :
...
228.00
17.50
1238.13
...
There is always one occurrence of € in each line. I want the numeric value that precedes this € occurrence. The random text (before and after) may contain numbers too, so the € may be important to parse, in order to correctly identify the number to return. The last character that precedes the number to extract is always a ">" (coming from an HTML tag).
This may be a basic bash array/string operation related question, but I couldn't find any direct answer. So here it goes:I have a lot of data sorted in various directories. All directories need same processing except for a special group of directories. I have a symbolic link of the script in discussion in each directory. I want the script to get the name of the current directory, check if that belongs to special group and do specific operations.So I get the name of the directory
Code:
mm=`basename `pwd``
Now the the group of directories that needs something different to be done, contains these
[code]...
I'm trying to use ${VAR:0:4} substring extraction described here: tldp.org/LDP/abs/html/string-manipulation.html and it works perfectly if i issue a command in bash. But when i put it in a script file and run it, bash gives me "bad substitution" error. Does anyone know how to fix it?
View 5 Replies View RelatedI have box that I run Sid on. I haven't used if for a month or so and have found that OpenOffice is gone and appears to have been replace by LibreOffice. I have come across one other thread which noted something similar. Is LibreOffice any better than OpenOffice? I plan to purge LibreOffice and install OpenOffice back on unless there is a good reason to keep LibreOffice.
View 14 Replies View Relatedmy 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
As trying to update my system the other day I was greeted with a message I did not want.
Code:
tpsv@titantest:~$ sudo apt-get install update
Reading package lists... Error!
E: Problem parsing dependency Replaces
E: Error occurred while processing language-pack-kde-nds (NewVersion1)
E: Problem with MergeList /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_karmic_main_binary-i386_Packages
E: The package lists or status file could not be parsed or opened.
i have filename like the following
1_40_37573.dbf
1_41_37573.dbf
1_42_37573.dbf
[Code]....
actually i want to extract the substring between 2 underscores
e.g. in case of 1_40_37573.dbf i need 40 and in case of 1_101_37373.dbf i need 101 and so on
I would like to extract a substring using sed.
the String is :
[1365465464.1654] fasfa fsaf df16A fas 2.2 (7/2134)
number result :
16A
I have been encountering this problem, not only on 10.4, but on older versions too: I use a wifi router to connect my laptop to the Internet, but sometimes I need to connect directly to another computer to move some files over GLAN. But Ubuntu's Network manager doesn't allow me to configure the eth0 interface without specifying a gateway (no gateway = grey submit button), but when a gateway is specified, it always rewrites the default gw specified already by the active wifi connection and returns back after unplugging the eth cable.
Of course this can be solved by a few route commands, but this is unacceptable since it is needed to establish the cable connection without any further assistance from within and as well without replacing the default gw and thus breaking the Internet connection. Is there, please, any possibility how to prevent Network Manager from replacing these routes?
for example
010100
this is the string
the substring is 010
i need to search for this substring and i also need to return the next 3 characters i.e 100.
i need to apply this for this string
01010000001001100000100010
I have a string variable
var1=<default>111</default>
I want the value between default tags 111 in this case.
I treid to use ${var1:10:3}
But the execution gived "bad substitution' error. If the tags are removed and substring is fetched it works fine. Is there any other was to get substring in a string with tags.
Code: cmd='date | wc'
$cmd If this script is executed, an error is generated. The reason written was that "The execution fails because the pipe is not expanded and is passed to date as an argument".What is meant by expansion of pipe. When we execute date | wc on the command line, it goes fine.then | is not treated as an argument. Why?
I am trying to learn how to pass more than a one-command startup for gnome-terminal.
I will give an example of what I'm trying to do here:
Code:
#! /bin/bash
#
#TODO write this for gnome and xterm
USAGE="
${0##*/} [-x] [-g]
code....
However, running with the -g option to invoke gnome-terminal, I get a "There was an error creating the child process for this terminal" error.
This same error occurs if the gnome-terminal line is changed to
Code:
gnome-terminal -e mcTerm
Is there any way to pass more than one command on to gnome-terminal? I have tried various single and double quoting senarios and in a final attempt, I abstracted to an exported function all to no avail. Perhaps even though gnome-term is better at many things than xterm, xterm trumps it in this instance.
I am writing a perl script which uses the matlab compiler to compile a .m file.
I am using the system("mcc �m file.m"). I have matlab installed and both script and exe are in the same drive.But i get the following error .
'mcc' is not a recognised as an internal or external command ,operable in program or batch file.
I am using gtk to program GUI. How can I show the output of shell command into a textbox, ex ps -efc command ?
View 3 Replies View RelatedI'm trying to convert this awk command from command line into an awk script, but just cannot get it to work:
This is what i have after my BEGIN
Am i missing something here? this just prints out the count for everyline, not counting lines on 5th field that match 'A'
suppose i store the history number of a command say :
1004 cat file
Then now i want to run it like : !1004 but by using a variable.
command=1004
!$command
i am getting errors like :
command=1004command
I got this definition:"a process that replaces a series of related, specific routes in a route table with a more generic route." honestly I found it not so clear.. I want to know if this definition is correct and also more details about this subject..
View 1 Replies View RelatedI am trying to grep multiple numbers from file, grep does have the -f option for that.
Code: grep -f <`seq 500 520` /etc/passwd I know this could be done with
Code: for i in `seq 500 520`; do grep "$i" /etc/passwd; done But my question is fare more behind this example. It is possible to redirect one command output which will be treat as a content of file for another command ?
Is there a command which can be used to run some other command on a few lines from a file or an o/p of some file. (the kind of role that -exec option does for the find command). (I have solved the purpose using a bash loop but would like to know if there exists a command).
View 4 Replies View RelatedWhat's the deal with this bloody commandI trying to do an update of a product.The -f is suppose to "force" the overwrite of existing files isn't it?Well every time I run the command it keeps asking me to allow it to overwrite the files.. the programs is too long for me to sit here hitting the "y" and "enter key"
View 2 Replies View RelatedI have a script that will build a list of hosts and it works fine Code: for ((i=$START; i<=$END; i++)); do echo "$NAME$i"; done But I need it to build the START and END on different number formats (i.e. 1 -> 10, 01->10, 001 ->010)
I am trying to use the seq command but can't get it to work quite right with the -w flag in the following Code: for ((myseq=$START; myseq<=$END; myseq ++)) do echo "$NAME${myseq}" done I am fully aware that this syntax is probably wrong, and need to know how to correct it.
Is anyone familiar with the Minix OS? i want to know what is the Process to add a new command in Minix that uses system call served by the memory manager server
View 1 Replies View RelatedDistro: Centos 5, PHP 5I have done a bit research on running bash commands from php and there was little success. This is my relevant php script
<?php
echo exec('pwd');
?>
[code]...
im trying to get the getopts command to run but for some reason the -d option fails to populate the variable and it remains empty.
Code:
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
[Code].....
I just create a simple c++ program on linux is there a way to intergrate linux command such as ls, du, df and etc on my c++ program?
View 1 Replies View Related