I currently try to find a solution to edit a column of a txt file, the problem is there a no column "endings?". I need to multiple the price by 1.1 & replace it with the new value (fields I need to edit 280,24
and 378,07
)
this txt updates every 12h so the prices change every 12h...
a row looks like this:
961983 5031713050124 44661802 3335 OKI 19 Lasertoner schwarz OKI 44661802 1 ST 280,24 378,07 29.05.2020 Lager Beschaffungsartikel nein
anyone has a sugesstion how i could do it?
Are the columns of fixed width? Then you could use preg_split as$data = preg_split("/[\s,]+/", $input);
and search for the term ST in the array and increment the next four fields as$num = (int)$data[index] * 1.1; $data[index] = $num;
Then build the string again using implode() as$input = implode("\number of spaces\",$data);
Note that this maybe treated as a pseudo code of PHP, the functions exist but since I dont know whether the spaces are fixed or not or the way to write back to CSV I cant write the exact code.
Please forgive me if I couldnt solve the question exactly.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.