LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 06-04-2011, 10:53 AM   #1
dmchess
Member
 
Registered: Jan 2005
Posts: 71

Rep: Reputation: 20
sed ?


My new router has a traffic meter on it. Unfortunatly it is only accessible from a web page with lots of JavaScript/Java in it. If anyone is employed here by netgear, Allow the user to either e-mail or ftp the data to themselves. You have an ftp server built right into the router. I managed to put a script together using firefox and iMacros. Then I format the output as a groups of MySQL insert statements which is then sent off via the script to the MySQL server. Ok, I got it working even though I had to do some things which aren't the best.

I couldn't format the insert statements with single quotes around the data items. I could get them formated with double quotes. I tried to use sed to change all of the double quotes to single quotes, but I couldn't get it to work. I ended up writing a tiny little Free Pascal program to do it.

The sed I tried was something like this:

sed s/'"'/'\''/ Traffic.dat

It would change some, but not all of them.
 
Old 06-04-2011, 11:28 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,630
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
I think you're just missing a 'g' on the end, to replace ALL occurrences in every line.

Code:
sed "s/\"/'/g" Traffic.dat
Hope this helps,
 
Old 06-04-2011, 02:54 PM   #3
dmchess
Member
 
Registered: Jan 2005
Posts: 71

Original Poster
Rep: Reputation: 20
Yes that worked, thanks.
 
Old 06-05-2011, 07:31 AM   #4
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,630
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
If you don't have any other (related!) questions, then could you mark the thread as 'SOLVED', please? There should be a link to do it at the top of the page...

Thanks
 
  


Reply

Tags
sed


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] sed 's/Tb05.5K5.100/Tb229/' alone but doesn't work in sed file w/ other expressions Radha.jg Programming 6 03-03-2011 07:59 AM
sed: how to change MAC address string with sed cold Linux - Software 5 08-02-2010 07:43 AM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 11:36 AM
sed and escaping & in something like: echo $y | sed 's/&/_/g' prx Programming 7 02-03-2005 11:00 PM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM


All times are GMT -5. The time now is 05:40 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration