How to find and replace string In many filesHow can I prevent SQL injection in PHP?How do I get PHP errors to display?How do I get a YouTube video thumbnail from the YouTube API?How do you parse and process HTML/XML in PHP?How do I check if a string contains a specific word?`require': no such file to load — mkmf (LoadError)How does PHP 'foreach' actually work?Reference - What does this error mean in PHP?How to list directories, sub-directories and all files in phpHow to get PHP files and their path changed after a date

Old story where computer expert digitally animates The Lord of the Rings

How do I tell my girlfriend she's been buying me books by the wrong author for the last nine months?

Does Apple Watch automatically stop walk/run workout?

How far can gerrymandering go?

Did NASA distinguish between the space shuttle cockpit and flight deck?

I agreed to cancel a long-planned vacation (with travel costs) due to project deadlines, but now the timeline has all changed again

Why will we fail creating a self sustaining off world colony?

Is it possible to alias a column based on the result of a select+where?

Is this house-rule removing the increased effect of cantrips at higher character levels balanced?

What would you need merely the term "collection" for pitches, but not "scale"?

Could you fall off a planet if it was being accelerated by engines?

Avoiding repetition when using the "snprintf idiom" to write text

Why are examinees often not allowed to leave during the start and end of an exam?

What are the children of two Muggle-borns called?

How soon after takeoff can you recline your airplane seat?

Disk usage confusion: 10G missing on Linux home partition on SSD

What does this Pokemon Trainer mean by saying the player is "SHELLOS"?

Can I deep fry food in butter instead of vegetable oil?

Having to constantly redo everything because I don't know how to do it

Does an NPC know when a character has passed the save for Truth Serum?

"in 60 seconds or less" or "in 60 seconds or fewer"?

What happens if a caster is surprised while casting a spell with a long casting time?

What is my external HDD doing?

What is this fluorinated organic substance?



How to find and replace string In many files


How can I prevent SQL injection in PHP?How do I get PHP errors to display?How do I get a YouTube video thumbnail from the YouTube API?How do you parse and process HTML/XML in PHP?How do I check if a string contains a specific word?`require': no such file to load — mkmf (LoadError)How does PHP 'foreach' actually work?Reference - What does this error mean in PHP?How to list directories, sub-directories and all files in phpHow to get PHP files and their path changed after a date













0















What I need Is to go thru a directory that contains subdirectories. In each second level directory has a third level directory that contains a file with same file name for every second level directory.



In each of those files made in PHP there Is a variable that contains like: appversion = 'YYYYMMDD'. I need to modify this date for each appearance To eg appversion = '20190301'.



How to do this In Shell or with PHP?



Edit: sorry for the malformed question, this is what defines better what I need to do really



I am afraid the question was a little malformed.
What I need to do is:
1. To find in all subdirectories a file called "productver.php".
2. In each "productver.php" file find a variable called 'appversion'.
3. Replace the value with a given value that i provide.
Example: I provide a date that is "20190324" and I want to change this to the value of all 'appversion' variables. E.g. 'appversion = 20180121' ==> 'appversion = 20190324'. For this reason, I am afraid simple replace is not enough as I only need to replace the part which is on the right side of the "=" character. And I cannot seek for a specific date, because the dates of this variable change. All I know is that I need to replace those dates, on the right side of the "=" sign of variable 'appversion'.










share|improve this question
























  • is it a one time issue or you need an automation? This can be done using IDE (Search and Replace or Refactor..). Otherwise a shell script using sed would be perfect.

    – Nik
    Mar 25 at 16:37











  • PHP str_replace('YYYYMMDD', '20190301', $string), sed could be used in shell.

    – user3783243
    Mar 25 at 16:40











  • Did you look at unix.stackexchange.com/questions/112023/…?

    – tk421
    Mar 25 at 19:00











  • Please see my edit on the main question. Sorry for the mess...

    – Alyssa Skogs
    Mar 25 at 19:30















0















What I need Is to go thru a directory that contains subdirectories. In each second level directory has a third level directory that contains a file with same file name for every second level directory.



In each of those files made in PHP there Is a variable that contains like: appversion = 'YYYYMMDD'. I need to modify this date for each appearance To eg appversion = '20190301'.



How to do this In Shell or with PHP?



Edit: sorry for the malformed question, this is what defines better what I need to do really



I am afraid the question was a little malformed.
What I need to do is:
1. To find in all subdirectories a file called "productver.php".
2. In each "productver.php" file find a variable called 'appversion'.
3. Replace the value with a given value that i provide.
Example: I provide a date that is "20190324" and I want to change this to the value of all 'appversion' variables. E.g. 'appversion = 20180121' ==> 'appversion = 20190324'. For this reason, I am afraid simple replace is not enough as I only need to replace the part which is on the right side of the "=" character. And I cannot seek for a specific date, because the dates of this variable change. All I know is that I need to replace those dates, on the right side of the "=" sign of variable 'appversion'.










share|improve this question
























  • is it a one time issue or you need an automation? This can be done using IDE (Search and Replace or Refactor..). Otherwise a shell script using sed would be perfect.

    – Nik
    Mar 25 at 16:37











  • PHP str_replace('YYYYMMDD', '20190301', $string), sed could be used in shell.

    – user3783243
    Mar 25 at 16:40











  • Did you look at unix.stackexchange.com/questions/112023/…?

    – tk421
    Mar 25 at 19:00











  • Please see my edit on the main question. Sorry for the mess...

    – Alyssa Skogs
    Mar 25 at 19:30













0












0








0








What I need Is to go thru a directory that contains subdirectories. In each second level directory has a third level directory that contains a file with same file name for every second level directory.



In each of those files made in PHP there Is a variable that contains like: appversion = 'YYYYMMDD'. I need to modify this date for each appearance To eg appversion = '20190301'.



How to do this In Shell or with PHP?



Edit: sorry for the malformed question, this is what defines better what I need to do really



I am afraid the question was a little malformed.
What I need to do is:
1. To find in all subdirectories a file called "productver.php".
2. In each "productver.php" file find a variable called 'appversion'.
3. Replace the value with a given value that i provide.
Example: I provide a date that is "20190324" and I want to change this to the value of all 'appversion' variables. E.g. 'appversion = 20180121' ==> 'appversion = 20190324'. For this reason, I am afraid simple replace is not enough as I only need to replace the part which is on the right side of the "=" character. And I cannot seek for a specific date, because the dates of this variable change. All I know is that I need to replace those dates, on the right side of the "=" sign of variable 'appversion'.










share|improve this question
















What I need Is to go thru a directory that contains subdirectories. In each second level directory has a third level directory that contains a file with same file name for every second level directory.



In each of those files made in PHP there Is a variable that contains like: appversion = 'YYYYMMDD'. I need to modify this date for each appearance To eg appversion = '20190301'.



How to do this In Shell or with PHP?



Edit: sorry for the malformed question, this is what defines better what I need to do really



I am afraid the question was a little malformed.
What I need to do is:
1. To find in all subdirectories a file called "productver.php".
2. In each "productver.php" file find a variable called 'appversion'.
3. Replace the value with a given value that i provide.
Example: I provide a date that is "20190324" and I want to change this to the value of all 'appversion' variables. E.g. 'appversion = 20180121' ==> 'appversion = 20190324'. For this reason, I am afraid simple replace is not enough as I only need to replace the part which is on the right side of the "=" character. And I cannot seek for a specific date, because the dates of this variable change. All I know is that I need to replace those dates, on the right side of the "=" sign of variable 'appversion'.







php ubuntu






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 19:30







Alyssa Skogs

















asked Mar 25 at 16:34









Alyssa SkogsAlyssa Skogs

92 bronze badges




92 bronze badges












  • is it a one time issue or you need an automation? This can be done using IDE (Search and Replace or Refactor..). Otherwise a shell script using sed would be perfect.

    – Nik
    Mar 25 at 16:37











  • PHP str_replace('YYYYMMDD', '20190301', $string), sed could be used in shell.

    – user3783243
    Mar 25 at 16:40











  • Did you look at unix.stackexchange.com/questions/112023/…?

    – tk421
    Mar 25 at 19:00











  • Please see my edit on the main question. Sorry for the mess...

    – Alyssa Skogs
    Mar 25 at 19:30

















  • is it a one time issue or you need an automation? This can be done using IDE (Search and Replace or Refactor..). Otherwise a shell script using sed would be perfect.

    – Nik
    Mar 25 at 16:37











  • PHP str_replace('YYYYMMDD', '20190301', $string), sed could be used in shell.

    – user3783243
    Mar 25 at 16:40











  • Did you look at unix.stackexchange.com/questions/112023/…?

    – tk421
    Mar 25 at 19:00











  • Please see my edit on the main question. Sorry for the mess...

    – Alyssa Skogs
    Mar 25 at 19:30
















is it a one time issue or you need an automation? This can be done using IDE (Search and Replace or Refactor..). Otherwise a shell script using sed would be perfect.

– Nik
Mar 25 at 16:37





is it a one time issue or you need an automation? This can be done using IDE (Search and Replace or Refactor..). Otherwise a shell script using sed would be perfect.

– Nik
Mar 25 at 16:37













PHP str_replace('YYYYMMDD', '20190301', $string), sed could be used in shell.

– user3783243
Mar 25 at 16:40





PHP str_replace('YYYYMMDD', '20190301', $string), sed could be used in shell.

– user3783243
Mar 25 at 16:40













Did you look at unix.stackexchange.com/questions/112023/…?

– tk421
Mar 25 at 19:00





Did you look at unix.stackexchange.com/questions/112023/…?

– tk421
Mar 25 at 19:00













Please see my edit on the main question. Sorry for the mess...

– Alyssa Skogs
Mar 25 at 19:30





Please see my edit on the main question. Sorry for the mess...

– Alyssa Skogs
Mar 25 at 19:30










0






active

oldest

votes










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55342484%2fhow-to-find-and-replace-string-in-many-files%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes




Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55342484%2fhow-to-find-and-replace-string-in-many-files%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현