Software :: Escape Single Quotes In Sed For Multi Line Pattern?

Jul 18, 2011

I have some code written in VHDL that looks as follows:

Code:
foo = "bar";
foo <= 'bar',

[code]...

View 1 Replies


ADVERTISEMENT

Software :: Use Command Line To Split A Single-lined XML Into A Multi-line XML?

Dec 9, 2010

I have a many text files that have XML tags all shoved into 1 line. I want to create a new file that splits each XML tag onto a new line. code...

View 3 Replies View Related

Ubuntu :: Double Quotes And Single Quotes Not Working In 11.04?

Aug 2, 2011

I am not sure If anybody has faced this issue, my keyboard is less responsive when pressing the double quote/single quote key, I have to press it twice for it to print the quote( and that too it prints some other data and not exactly a double-quotes). Initially I thought it was issue with my keyboard, but later I see that it is working fine in Windows XP. It looks some kind of setting issue. If you check the below two examples, example a) is the double quote printed in Ubuntu, it doesnt exactly looks like a double-quotes and b) is the one printed in Windows.

View 1 Replies View Related

Programming :: Double-quotes Do Not Escape Properly (bash=python)?

May 2, 2010

I wrote the Automatik widget (you can find it at :http://kde-look.org/content/show.php...&PHPSESSID=caeTo improve it, I would like to add this one-line script into a text sensor :

top -b -n 1 | head -12 | tail -6 | sed '/top/d' | awk '{ printf "%-12.12s %-4s %-4s %-3s
" , $12,$9,$10,$2}'

[code]...

View 3 Replies View Related

Programming :: Search A File For A Particular Pattern And If Pattern Found Replace The Line With New Text?

Feb 24, 2010

I want to search a file for a particular pattern and if pattern found replace the line with new text. i am using awk 'match($0,"pattern") != 0 {print $0} ' filename to check if the pattern exists.how do i get the line number of the pattern and delete that line and replace the line with my new text?

View 1 Replies View Related

General :: Printing Single Quotes With Awk?

Jul 27, 2011

I have the following command, which works fine:ll /backup/PROD |grep PROD_ |awk -F" " '{print "catalog backuppiece /backup/PROD/"$9";"}'The output is:catalog backuppiece /backup/PROD/PROD_29mi42vn_1_1;BUT... I want single quotes in the result. One before /back.. and one before the ;Like this:catalog backuppiece '/backup/PROD/PROD_29mi42vn_1_1';How do I do that? I tried using ' but it does not work.The following command works, but I get an error message, which prevents me from using the command in a bash file:ll /backup/PROD |grep PROD_ |awk -F" " '{print "catalog backuppiece '''/backup/PROD/"$9"''';"}'awk: warning: escape sequence `'' treated as plain `''

View 3 Replies View Related

General :: Identify The Single Quotes As Literals?

Mar 9, 2009

I want to grep for $_POST['whatever']. I've done enough googling and trying different things (and failing) to where I felt it appropriate to post here. How do I identify the single quotes as literals? slashes don't seem to do it.

View 1 Replies View Related

Fedora :: Keyboard: Single And Double Quotes Not Working?

Jan 21, 2010

I have a problem with my keyboard. I�m unable to type single or double quotes, at least not the regular sort that you need to write code in almost any programming language ever invented -which makes it pretty useless.A demonstration.Single left and right tilted quotes:Double quotes: m not able to type a single straight quote at all.I just want my keyboard layout to be standard US like everyone elses so I can get on with my work so does anybody know how to just reset it to a normal layout?

View 4 Replies View Related

Debian :: X: Unable To Open Display '' (two Single Quotes)?

Jun 10, 2010

I'm experimenting with old linux Distributions again, and while trying tostart an x server, I get the following error message:X: unable to open display ''That makes me think that the config file is incomplete, but I would have no idea how to make it. If there is an auto configuration utility that I do not know about for X, it would be great to hear about. Here are some other specifications that might help:*Host: VMWare Workstation on Windows XP Home*Distribution: Debian 2.2 (potato) (Yes, I know it's old.)*Connection: Local. I've heard of people having difficulties like this on remote connections, but I am on the physical computer

View 7 Replies View Related

General :: Replacing Single Quotes In Filenames With Another Character

Jan 26, 2011

Can anyone offer a code snippet to recursively go through directories and replace any single or double quotes quotes found in a filename with another character (e.g. "_").If any of the filenames contain a single quote or double quote, then replace it with an underscore.

View 7 Replies View Related

Programming :: Python - String To Omit The Single Quotes (')?

Mar 18, 2011

After I assign a string to a variable, I know that the print function will remove the single quotes around the value, but is there a way to assign a variable without the quotes around the value? for example:

a = open('/usr/lib', 'r+')
b = f.read()
c = x.replace('.xx','yy')
d = ?

c returns the value with quotes around it print c returns the value without the quotes Is there a way to assign a new variable (d) which will equal c without the quotes? I need a new variable which has the quotes omitted because from there the script will take the value of the last variable (which is a path to a file), and tar up that file. It won't recognize the path to the file if the value has quotes around it.

View 1 Replies View Related

Fedora :: Inserting To Escape Single Quote For Mysql Insert?

Oct 2, 2010

the project I'm working on requires parsing a text file with fields separated by the | char and using perl to insert/update a mysql database. Some of the fields are simple numeric and others are text fields. In some of the text fields I run into a problem creating a proper insert statement for the perl api to mysql if I don't escape the single quote (') char with a backslash (). I can take each text file and do a manual subsitutiton, but I would prefer to use the script that prepares the text file to do it for me. I've tried sed (ex: sed s/'/\'/g ) and it runs cleanly, but does nothing to accomplish my goal. I suppose I could write a function to read the file character by character and write it out that way, but it seems a waste.

View 2 Replies View Related

General :: Parse A File And Print Each Line That Ends With Matching Pattern (if The Next Line Is Blank)

Aug 2, 2010

I've written a script to parse a file and print each line that ends with matching pattern, if the next line is blank. The pattern lines are the result of md5sum $i|sed 's/path///g' so that only md5 and filename appear. Here's what I'm using.

Quote:
for fline in `sed -n '/.*.ext$/p' file1`
do
if [ "`sed -n -e '/'"$fline"'/ {n; p;}' file1`" == "" ]
then
echo ""$fline" has no info" >>file2
fi
done
[Code]....

View 4 Replies View Related

General :: Sed To Display The Pattern String - The Line Above It And The First Line Of That Para

Mar 30, 2011

I need to grep for a particular string and if found need to display the line containing that string, the line above that and also the first line of that paragraph.

Can this be done via sed.

Eg, My Paragraphs

OA connectA

Enclosure:

Interconnect Module #6 Status:

Here, if I grep for Critical, it should display the following

Similarly if I grep for Degraded, it should display

View 3 Replies View Related

Ubuntu :: Boot Into Single User Mode Or Escape Out Of This GDM / X11 Fail Cycle?

Jul 3, 2011

I installed Ubuntu 11.04 and it refuses to show me a boot menu so I can select single user mode. When it does boot, it continues to cycle as X11 fails, but will not let me change into any of the consoles via control+shift+1-7 or control C or any command. X11/GDM continues to cycle as I hear my video card keep spinning up and down. In every version prior, after 3-4 fails it would give you a shell and say, ok it failed. how to boot into single user mode or escape out of this GDM/X11 fail cycle?

View 1 Replies View Related

General :: Surround A Line With Quotes On Bash?

Apr 24, 2010

When I run for i in $(find -name '*.ogg'); do echo '$i'; done I don't get one line per file as I expected. Instead, when a file name has a space in it, each word comes out in a separate line, so I can't run commands on the files.

View 4 Replies View Related

Ubuntu :: Escape Sequence For New Line In Python?

Apr 14, 2010

I am reading "A Byte of Python" and this is the 2nd time I've completely been confused about something:"What if you wanted to specify a two-line string? One way is to use a triple-quoted string asshown previously or you can use an escape sequence for the newline character - toindicate the start of a new line. An example is This is the first lineThis is thesecond line. Another useful escape sequence to know is the tab - There are many moreescape sequences but I have mentioned only the most useful ones here."In python:>>> "This is the first lineThis is the second"'This is the first lineThis is the second'>>>

View 1 Replies View Related

General :: Replace New Line With <br /> And Escape Special Characters?

Feb 6, 2011

I wish to replace a new line with br (html) but it doesn't seem to work

Code:

message=$(echo ${FORM_message} | tr '
' '<br />' )

what it gives me seems to be ... b...? I am also having problem escaping hash sign in cut command:

Code:

list=$(echo "$line" | cut -d'#;#' -f1) ;

my intention is to split the line with "#;#"

View 5 Replies View Related

General :: Shell Script To Extract Single Report By Pattern Then Both Backward And Forward

Feb 18, 2010

I have to admit that I register to LQ after I failed to search for similar solutions.let me see whether I can explain my problem clearly. I need to extract a single report from a big file. The big file looks something like this:

Report for yyyyyy
Your info 999-9999999
End of Report

[code]....

I need to search for a user provided string, say 999-9999999, in the big file. Then I have to extract the single report. My logic is simple,

1) find 999-9999999
2) backward search for "Report for", note down the line number
3) forward search for "End of Report", note down the line number
4) extract the record by using info found from step 2) and 3).

I am trying to do this in bash, with awk and sed (I am new to both).

View 8 Replies View Related

Programming :: Delete Line Containing A Pattern?

Apr 1, 2011

if the given pattern exists in the file with the very next line starting and endingwith the same pattern , delete the line that starts and ends with the given pattern.So upon running on this file

hai people<PATTERN> we had
<PATTERN>a lot of fun<PATTERN>
writing scripts

[code]....

View 6 Replies View Related

General :: Use Ghostscript To Convert Multi-page PDF Into Single JPG?

Jul 27, 2010

I know Ghostscript can convert PDFs to JPGs, and in the case of a multi-page PDF, can rip each page to an individual JPG. But is it possible to have it rip them to one JPG, so that the pages are pasted below each other, e.g. the top half of the JPG is page 1, the bottom half is page 2? Or do I have to use another program (and can ImageMagick do this?) to combine the JPG pages into one image?

View 2 Replies View Related

Programming :: Sed: Delete Last Line Matching A Pattern?

Mar 27, 2011

I have a question about sed programming, actually a one-liner for which I cannot find a solution, right now. I need to delete a line matching a specific pattern only if it is the last line. In practice, I would put together the following:

Code:
#
# This deletes the last line of a file

[code]...

View 5 Replies View Related

CentOS 5 Networking :: DHCP Multi-Subnet From Single Server?

Oct 24, 2010

I've got a bit of a question. My network is laid out like this:

The role assignments are thus:

Firewall - sorts out the passing through to the 3 different networks, and acts as the traffic proxy.
Windows 2003 server - Does Active Directory and DNS
CentOS server - FTP and DHCP

Now, my problem is I need the CentOS server to be able to assign IP address to both networks, however, the CentOS server can *ONLY* be connected via the one interface to the firewall. It needs to assign the Windows 2003 server and the eth0 of the firewall an IP address via static DHCP, but it also needs to able to assign the clients dynamically via any address in the 10.23.1.0/24 range. I was thinking that I would be able to create static only assignments for the servers via their MAC addresses, and only have 1 dynamically assignable entry for the clients, and then get the firewall to allow ports 67 and 68 to flow freely between eth0 and eth1, but I wasn't entirely sure of the best way to do all this.

View 1 Replies View Related

General :: File Matching Pattern On Command Line?

Sep 9, 2011

I've got files in a directory as follows:

1.png
1_thumb.png
1-1.png
1-1_thumb.png

[code]....

I want to list all the files that don't have a copy with the same filename with -1 somewhere in it. So, in the example above, the results would be 3.png.

NB: the file and its copy with "-1" in it will be the same filesize, if that helps.

View 2 Replies View Related

Programming :: Insert Line Of Text Prior To Pattern Only Once?

Jun 29, 2010

I have a file like so:

Code:

one
two
three
four

I would like to insert prior to the word "three" all items from this second file with the following contents:

Code:

four
three
two
one

Now my issue is, and I have been using both sed and awk currently, that after the second line of the new file is read there will of course now be 2 copies of the word "three" but I would like to only insert the final 2 words, ie "two" and "one" prior to only the first occurrence of the word "three" so final file will look like:

Code:

one
two
four

[code]....

So here there is now only one of each word from the second file joined to make the new file. For simple code I have tried something like the following:

Code:

while read line
do
awk -v n=$line '!f && /three/{print n;f++}1' file1 > tmp_file
mv tmp_file file1
done < file2

Now this works but seems very clumsy to me. There is obviously a better sed and / or awk out there.

View 5 Replies View Related

Programming :: S/ Command Won't Replace Two Occurrences Of Pattern On Same Line

Dec 15, 2009

Here's the actual line of code, which exists in a bash script:

Code:

I want to replace instances like this:

Code:

with this:

Code:

Using this:

Code:

Which works great when there's only ONE of the pattern on the line. But in a case like the "actual line" I posted first, where there are two patterns, separated by a slash, only ONE gets replaced

Watch:

Code:

Why? There must be (among many other things) something I'm not knowing about sed, that's causing this.

-- I'm currently using the ~ (tilde) as the separator in the sed command. It doesn't matter, I've used / ~ and % with no difference.

-- As a test, I tried putting a different character(s) in the middle of the original pattern instead of the / but that made no difference.

-- I've come up with various similar but slightly different regexs that will do this replacement, but they all have had this same result.

-- I tried the sed single-quoted, double-quoted, and unquoted; the latter fails to execute, and the formers both work as described here: wrong.

View 7 Replies View Related

General :: Delete/grab A Line Which Matchs A Pattern Of A Particular Column Only?

Jan 18, 2010

I have found many information about how to delete/grab a line in a text file including delete line with match a pattern but I did not find info about how to delete a line which match a pattern of a particular column only.

for example mydata.txt:
id type x y z
1 6 0.474611 0.227223 0.583947

[code]....

View 6 Replies View Related

Programming :: Multiple Line Pattern Matching And Variable Extraction?

Oct 19, 2010

I have this complex log file filled with entries like

test1-G1/0/0-100-QOS-7001923-ROUTING (ClassMap)
Action: Resolved New
sysName: test1.local

[code]...

View 1 Replies View Related

Ubuntu :: System Dies - Monitor Emits Flashing Line Pattern?

Jul 7, 2010

I have installed Ubuntu 10.04 on a Dell Dimension 2350/ 2Ghz P4/ 1.5GB memory.After running for up to 10mins the system dies and the monitor alternates between black & a half-screen display of vertical black & white bars every second or so (first the top half then the bottom half of the screen). The unit has the standard Intel onboard graphics chip.The same happens with Ubuntu Studio & Xubuntu yet Mepis 8.5 & Fedora 13 run without problem.It's a standard installation of Ubuntu & all updates have been applied.

View 4 Replies View Related

General :: Removing A Line From File Which Is Having Specific Pattern Using Shell Script?

Mar 20, 2011

I'm new to the shell scripting. can any one help in creating shell script for matching the content of the specific variable with file. it should remove that line from the file if line is containing same value as variable and keep the other content as it is.i used grep -v for accomplishing the same. But grep will remove the pattern which is similar.For eg. Assume file "test" contain datas :aaffif i used grep -v command for the pattern "a" to this file this will remove content "aa" from the file. I want the pattern only "a" should remove from the file, if it is existing. otherwise it should throw alert content not exists.

View 5 Replies View Related







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