General :: Define A String Of Repeated Characters?

Feb 5, 2011

this seems like it should be a simple thing, but I can't find it. Is there a bash shell command that allows you to create a string of repeated characters? Like a string of 100 '*'?

View 6 Replies


ADVERTISEMENT

General :: Find A Substring In A String And Get The Next 3 Characters

Mar 5, 2010

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

View 8 Replies View Related

General :: Using Sed To Replace String With Special Characters In XML File?

Apr 29, 2011

I am having difficulty getting sed to replace a string of text in an XML file, despite the fact that I have no trouble using grep to find that same string. Since the new string and old string to be replaced contain a lot of special characters, I thought it best to store them in variables as opposed to using a slew of backslashes:

OLD_STRING='<property name="webServiceHost">${jboss.bind.address}</property>'
NEW_STRING='<!--<property name="webServiceHost">${jboss.bind.address}</property>-->'

[Code]....

View 2 Replies View Related

General :: Search And Replace String Having Multiple Special Characters

Aug 26, 2009

Below is extract of my file:

What I need is to replace "--destination-path=" with "--destination-path=/home/dest"

i.e. desired output is ----destination-path=/home/dest

I could achieve it with below command

$cat outgoing-xfer|grep destination-path|perl -pi -e "s/destination-path=/destination-path=/home/dest/g"

But the problem is that in this case i just wanted to append "/home/dest" for which I could easily escape "/" with just two "", but I wonder if i have a long path like "/a/b/c/d/e/f/g/h/i/j" I will have to escape so many /. Is there any other way by which I can avoid escaping forward slash.

I tried following:

But receiving follo error

Bareword found where operator expected at -e line 1, near "s/destination-path=/'destination-path=/home"
syntax error at -e line 1, near "s/destination-path=/'destination-path=/home"
Bad name after dest' at -e line 1. tried with enclosing in double quotes as well but in vain

View 5 Replies View Related

General :: Grep A String Like "ab?c12345678" Where 3rd Character Is Unknown While Other Characters Are Known?

May 7, 2011

How to grep a string like "ab?c12345678" where 3rd character is unknown, while other characters are known.

View 2 Replies View Related

Programming :: Split A String By Every Nth Characters?

Jan 17, 2011

splitting a string by every nth characters. I'm using Python 2.7.1 because I'm using older libraries, if that matters.

For example, if this is my input:

Quote:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed ac elit nibh, vitae venenatis ligula. Vestibulum a varius turpis.

Splitting it by every 10th character should produce this list:

Quote:

[ "Lorem ipsu", "m dolor si", "t amet, co", "nsectetur ", "adipiscing", " elit. Sed", " ac elit n", "ibh, vitae", " venenatis", " ligula. V", "estibulum ", "a varius t", "urpis." ]

View 6 Replies View Related

Programming :: How To Insert Characters Into String In Shellscripts

Nov 15, 2010

My problem is to insert one sign like space or ':' into a line or string.The goal is to get a demiliter for `cut`.I tried to do it with `tr A-Z "'A '-'Z '" and such but without success.I guess a while read loop could do it but I don't know howto use it with ` expr length $STR`

View 5 Replies View Related

Programming :: Remove Special Characters From String

Jan 30, 2011

I am reading strings from a file using readline() function,the file contains some strings which has only special characters, I need to avoid the strings which has only special characters, the special characters are not similar. How to do it in python.??

View 2 Replies View Related

Programming :: Count The Number Of Occurrence Characters In A String ?

Jan 26, 2011

How do I count the number of occurrence characters in a string in an efficeint way ?

How do I reverse the words in a string with out using temp variables if possible . (if not possible use temp variables ?

Why do I specify dependedcies for header files in the Makefile ?

View 2 Replies View Related

Programming :: Remove All Alphabetic Characters At Beginning Of String

Jul 26, 2010

I am working with a Tcl script and have some strings in the following format (RE):
[a-zA-Z]+[0-9]{6}-[0-9]

There are some leading letters, combinations of capital and lowercase. Then six digits, followed by a hyphen, then one more digit. I would like to remove all of the leading alphabetic characters from the string. The resulting string would then be in this format: [0-9]{6}-[0-9]. In other words, six numeric digits, a hyphen, then one more digit.

I have tried:
Code:
set newstr [string trimleft $origstr alpha]
But that only removes the first alphabetic character, not all of them.

I couldn't get anything with regsub to work correctly, but I am somewhat of a noob with RE's in general and regsub in particular. There are usually 5 leading letters at the beginning of these strings, and I could in most cases get away with using string replace and constant indices to extract the substring. However, my preference is for this to be robust enough to handle all cases with 1 through n leading alphabetic characters.

View 3 Replies View Related

Programming :: Use Sed To Find String Pattern And Delete Subsequent Characters?

May 3, 2010

I have a file with a number of strings like the ones below

string1#m1asdfe23easdf23wefas
string2#mfaaeb2vr1rhserh
anotherstring#ji89ensrsegr
anotherone#m1ynmdt324nsdt

I'm trying to delete everything after #** so that

string1#maasdfeaveasdfawefas
string2#mfaaebvrserhserh
becomes
string1#ma
string2#mf

tried sed 's/#..*//g' but as you all will know it returns string1, string2 etc.

View 12 Replies View Related

Programming :: Java Regex - Use Regular Expressions Find Out What The First Two Characters Of The String Are

Feb 2, 2011

What I am doing is reading the text from a text document and storing all of the text inside of a ArrayList. I then set one of the values of the Arraylist as a string. I want to use regular expressions find out what the first two characters of the String are. if first two characters = "//" then function(); I only care about the first two characters though. If you need any more information, just ask.

View 4 Replies View Related

General :: Does Non-printing Characters Escape Characters Still Needed For PS1 Definition?

Aug 28, 2011

While modifying the definition of my PS1, I saw that "[" and "]" markers should be added to help bash to compute the right display lenght. Many exemples on the web do not use them or even mention them.I searched for a solution to add them automatically, like with sed, but I didn't find any example.Are they still needed and is there a recommandation not to use sed to define PS1?

View 1 Replies View Related

General :: How To Schedule For A Repeated Task

May 2, 2010

I need to schedule for a repeated task on my Linux, as the followings:

-) Telnet to a remote node
-) Issue a command
-) Capture the output in a log
-) Logout from Telnet
-) Wait for a prescribed time interval
-) Then redo , but append the subsequent output in just on file

know which options do we have to write such a task?

View 7 Replies View Related

Programming :: Copy String A To String B And Change String B With Toupper() And Count The Chars?

Oct 22, 2010

copy string a to string b and change string b with toupper() and count the chars

View 3 Replies View Related

General :: Replace String With Empty String Of Dir Path ?

Apr 2, 2011

I want to replace a string of directory path in a string to empty:

Code:

But this doesnt seem to give me the desired thing:

Code:

This gives the desired outcome, but its specific, i need a variable in the sed not a string. And if I replace STRING="/mnt/sda1/record/$dd/" then I cant use it for something else, cause its has all the weird backslashes now.

View 3 Replies View Related

General :: Checking If Table Name Is Repeated In File And If Yes - Remove It ?

Jan 20, 2011

I have an output file that looks like this:

Quote:

Now if you see the first line:

Status for ACCOUNT_MISSING_FRM_RCIS_LINK- mismatch

Status for ACCOUNT_MISSING_FRM_RCIS_LINK is ACCOUNT_MISSING_FRM_RCIS_LINK- does not exist in DB

This should appear just once as :

Quote:

The same goes for last line.

For further information the ACCOUNT_MISSING_FRM_RCIS_LINK is a table name and it row count is taken from a log and then Database checked for the rowcount to see if it is a match,mismatch,or the table does not exist!

I am getting the desird output just that i need to do something to this output file.

View 13 Replies View Related

General :: Directory Hierarchy Getting Repeated In Mvfs File System

Feb 9, 2011

I have a mvfs file system mounted.

[code]...

View 1 Replies View Related

General :: Extract A String Within A String Using A Pattern?

Nov 4, 2010

i have a file name using the following pattern:

PREFIX: AR
SOURCE: LEGACY
DATETIME: YYYYMMDD_HH24MISS
SUFFIX: .txt

sample filename:AR_LEGACY_20101104_105500.txti want to extract the source which is LEGACY in this case. how do i do this using shell?

View 1 Replies View Related

General :: New Install Of Debian Of PPC G4 Not Booting With Repeated Message - Drive Not Ready

Mar 17, 2010

I just installed Debian onto a PowerPC G4 Tower with two hard drives. I left OS X on one of the drives and reformatted and installed Debian on the other, using the installer from the 60Mb ISO from the Debian website.

The installation had no issues and it starts yaboot and Debian no problem.

After about 2 minutes of the booting up process, it starts to output this, every five seconds:

While this happens, other things still continue load and it outputs occasional messages and even gets to "Debian Login:" where if you type really quickly and hit enter, it takes it and prompts for "Password:" right after the next round of the above messages.

I have not been able to completely log in yet.

I can start up into the shell as root with "Linux single" with no problems.

I think this might have something to do with the second Mac OS Formatted Hard drive. I have considered unplugging that drive and testing it that way, but I am looking for a solution to turn off whatever script is running that every five seconds and failing, regardless of what it is trying to do.

View 9 Replies View Related

General :: Define TAB Key At Terminal?

Jul 7, 2010

I want to define TAB key at terminal.When i press TAB key i want all files shows like "ls -ltrh -color"

View 12 Replies View Related

General :: Awk Gsub() Command - String (column) Manipulation - Replace The Value Of The $1 Column In The Awk Print String?

Mar 7, 2010

i use this script to get the time and date of back and fourth transactions for a particular execution id. I use a substr command on the 5th column to to cut the milli seconds off the time value. - otherwise the times would look like 08:30:04.235

grep <executionID> <auditfile> | awk '{ print $1, $2, $3, $4, substr($5,1,8}
FIX -> Mon 3/1/2010 08:30:04
FIX <- Mon 3/1/2010 08:32:36
FIX <- Mon 3/1/2010 08:35:08

[code].....

anyhow - i append two sed commands to further clarify the direction of the message.

awk '{ print $1, $2, $3, $4, substr($5,1,8} | sed -e 's/->/ ->IN/g' | sed -e 's/<-/<-OUT/g'
FIX -> IN Mon 3/1/2010 08:30:04
FIX <- OUT Mon 3/1/2010 08:32:36

[code]....

I tried using an awk gsub () command within the string instead of the two seds, but it did not work:

awk '{ print gsub(/<regex>/, <replace with>,$1), $2, $3, $4, substr($5,1,8}

the sed works ok, but it would be cooler to make the replacement within the awk command:

gsub(/->/,-> IN, $1)

Is there a way where i could replace the value of the $1 column in the awk print string?

View 1 Replies View Related

General :: Define A Proxy In VNC Client?

Feb 8, 2010

'm trying to access remotely to my computer that is in my home with a VNC client. The problem is that from my company site, I'm behind a proxy and I must use this proxy to connect my computer.I'm new to the vnc programs, so I don't know how to define a connection to use the proxy. My laptop is well configured, the only problem is set a vnc client to use a defined proxy. 1 - I've installed VNC viewer or tightvnc viewer, but I can't find any option in it to define a proxy. How can I define a proxy in this program?2 - Is there any vnc client that allows to define a proxy?3 - Should I define a tunnel that redirects my connection to my remote PC? For example, if I define a tunnels that from localhost:5656 it connects to my remotePCort through the proxy will I hane any problem

View 1 Replies View Related

General :: String Replace In Filenames - Files Already Contain The String "Soundtrack"

Jun 11, 2011

Moving right along, I have a folder of MP3 files containing various Movie sound tracks and scores. I'm using Audio Tag Tool to tag all the files at once with an "Artist" of "Soundtrack", and to inherit the "Title" tag from the file name. After that, I will rename all the files (Using Audio Tag Tool -- awesome program, btw) with the format "<Artist> - <Title>.mp3"

The problem, is many of my files already contain the string "Soundtrack", which would be redundant. I happen to be a perfectionist, so I'm unable to ignore it and move on. Hence my question to you fine folk: I want to delete all instances of "soundtrack" (-i case irrelevant) in the filenames before I go through the above steps. But, its not quite that simple. This is a sample of some of the file names:

[Code]....

View 3 Replies View Related

General :: Define Ctrl-[ As A Shortcut In Emacs?

Aug 9, 2010

On Linux, the Ctrl-[ key combination appears to be equivalent to hitting the Esc key. I would like to define Ctrl-[ as a shortcut in emacs but I am unable to because by the time the keystroke gets to emacs it looks like the Esc key was pressed. Is there anyway to disable this behavior so that Ctrl-[ simply means Ctrl-[?

View 2 Replies View Related

General :: How To Define File Type For Wget

Jan 25, 2011

how can I define file type for wget to download . for example I do not want to download *.html or I just want to download *.jpg files . or if it does not support any of them do you know any other suggestion ?

View 1 Replies View Related

General :: Define Root For A Hard Disk?

Feb 8, 2010

When installing Linux,sometimes i tried to install that on my second hard disk, which is set to be a dynamic disk(named hdb),but a message said that: root is not defined for hdb.
-What does that mean? Does it mean that a Linux driver must be opened on that hard disk? if so:where do i find a linux driver

View 3 Replies View Related

General :: Add A Rule In User Define Chain?

Nov 30, 2010

I have created a new user define chain # iptanles -N blacklistNormally when we add a new rule it automatically insert in the default iptable but when we create a user define chain then how can I add my rules in this chain ?

View 3 Replies View Related

General :: Define File_operations For Kernel Ioctl Call?

Apr 8, 2010

I have a kernel function device_ioctl(). How do I define it in file_operations?

1. struct file_operations memory_fops = {
ioctl:device_ioctl
};
2. struct file_operations memory_fops = {
.ioctl=device_ioctl
};
3. struct file_operations memory_fops = {
device_ioctl
};

which one is the right one?

View 1 Replies View Related

Ubuntu :: Delete All ASCII Characters In File - Leave Chinese Characters Only

Jul 8, 2011

What command could I use in terminal to delete all ASCII characters? That is, delete a-z, A-Z, 0-9, and all punctuation? I have a file containing Chinese characters, and I want to remove everything else and leave just the Chinese.

I can use grep to leave only the lines that have Chinese in them, but this still leaves a lot of non-Chinese stuff on those lines. Does anyone know how I could actually remove everything that isn't Chinese?

View 4 Replies View Related







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