Author Topic: text file changing  (Read 1799 times)

Offline reaper

  • Opulent Member
  • *
  • Posts: 2872
  • Nice night for a walk, eh? - Nice night for a walk
    • View Profile
  • Rated:
text file changing
« on: April 14, 2009, 12:07:40 PM »
Quote from: sed
sed 's/^"/'\''/' quotes
sed 's/^\./'\'',/' quotes

Quote from: php

<?php
$myRandomQuotes=array
(
/*enter array elements like 'adsfasdf','asdfasdfasfd',
);
echo $myRandomQuotes[rand(0,sizeof($myRandomQuotes)-1)];
?>

So I wanted to put in some rotating quotes in this web page, and the quote file I got had a weird format.  Basically any " ' " in the quote file I espcaped with \ ( I left the sed command out for this), and I put the " ' " at the beginning and " ', " at the end with sed.  Out of the thousands of lines only a few didn't work for some reason.  I got the sed commands to work, but I really don't know how it is working, it was pretty much a guess.  How does bash pass parameters to sed when I am adding more single quotes and escaping some, and is bash passing the parameters to sed really the problem when I want to replace say.. the start of a line with the single quote?


edit:
I'm asking is bash passing the parameters to sed the reason I need the extra single quotes, and once in sed , how does it interpret the line.  I guess if someone knows how that's taking place in more detail it would help.

here's how the quotes looked,
'"Death does not concern us, because as long as we exist, death is
 not here. And when it does come, we no longer exist."
 -- Epicurus.
,

sometimes there were words like "won't", and escaping the single quote worked for the php array
« Last Edit: April 14, 2009, 10:01:57 PM by reaper »
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
VaeVictus "reaper is a lying sack of shit and ragequit then had, probably slugs, come alias and beat me, wasnt even the same person playing OBVIOUSLY, accuracies basicly doubled, and strategy

Offline reaper

  • Opulent Member
  • *
  • Posts: 2872
  • Nice night for a walk, eh? - Nice night for a walk
    • View Profile
  • Rated:
Re: text file changing
« Reply #1 on: April 30, 2009, 01:15:17 PM »
 :(
  • Insightful
    Informative
    Funny
    Nice Job / Good Work
    Rock On
    Flawless Logic
    Well-Reasoned Argument and/or Conclusion
    Demonstrates Exceptional Knowlege of the Game
    Appears Not to Comprehend Game Fundamentals
    Frag of the Week
    Frag Hall of Fame
    Jump of the Week
    Jump Hall of Fame
    Best Solution
    Wins The Internet
    Whoosh! You done missed the joke thar Cletus!
    Obvious Troll Is Obvious
    DO YOU EVEN LIFT?
    DEMO OR STFU
    Offtopic
    Flamebait
    Redundant
    Factually Challenged
    Preposterously Irrational Arguments
    Blindingly Obvious Logical Fallacies
    Absurd Misconstrual of Scientific Principles or Evidence
    Amazing Conspiracy Theory Bro
    Racist Ignoramus
VaeVictus "reaper is a lying sack of shit and ragequit then had, probably slugs, come alias and beat me, wasnt even the same person playing OBVIOUSLY, accuracies basicly doubled, and strategy

 

El Box de Shoutamente

Last 10 Shouts:

 

Yotematoi

May 17, 2025, 08:33:15 AM
Yo desde el año 2007 me enfermé de Q2, es incurable  
Morir y revivir es costumbre, lástima q el QT estaba bueno
 

ImperiusDamian

May 12, 2025, 01:45:35 AM
Quake II is not 27 years old. I refuse to accept THAT much time has gone by.
 

|iR|Focalor

May 11, 2025, 02:33:39 PM
 

-Unh0ly-

May 03, 2025, 08:02:46 AM
198.179.6.200:30634
 

Yotematoi

May 02, 2025, 10:27:47 AM
Note for Player-4109 "Remember, the Guinness Book of Records does not include cowards who shot at someone by treachery." :D
 

|iR|Focalor

April 02, 2025, 02:47:07 AM
 

Yotematoi

February 14, 2025, 12:41:48 PM
 :-*
 

|iR|Focalor

February 13, 2025, 07:31:24 AM
I was on DM this morning for the first time in a pretty long time. Seemed fine to me.

0rbisson

February 13, 2025, 04:54:21 AM
DM server is fucked. 2 point blank rockets from spawn and lava damage and player survived? WTF?" Also someone has fucked with the spawn points, every single time no matter how big the map you spawn right in front of the person who killed you last

Show 50 latest
Welcome, Guest. Please login or register.
May 18, 2025, 07:49:00 AM

Login with username, password and session length