Sponsored Content
Full Discussion: Replace value in files
Top Forums UNIX for Advanced & Expert Users Replace value in files Post 302372982 by killos on Thursday 19th of November 2009 10:20:59 AM
Old 11-19-2009
I've been getting syntax errors... but I've looked at this from different approaches (also taking in account your suggestion) and I've come up with this:

---

for x in `find . -size -9000` ;do sed 's/TYPE,1/TYPE,0/' <$x> $x.new;
rm $x;
mv "$x.new" /usr/local/data/backdata"$x";
echo "$x" >> ./logfile
done

-------

But I haven't been able to test it 'cause to add to my great day the server gone done, ha!!


---------- Post updated at 10:20 AM ---------- Previous update was at 06:41 AM ----------

thanx for the Franklin52....I have it working, it was jerkin me about on the rename, but with a suggestion I moved it to another directory first.

---------- Post updated at 10:20 AM ---------- Previous update was at 10:20 AM ----------

thanx for the Franklin52....I have it working, it was jerkin me about on the rename, but with a suggestion I moved it to another directory first.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how find and replace into different files

Hi, I have a serie of files in a directory. Into this files I´ve got lines with a serie of numbers like "12344332","1","2","3","4","5","6","7","3","7","7","8","3","7" I need make some changes on the line where is a specific string, for example numberToIdentify = "12344332". And once... (1 Reply)
Discussion started by: ran
1 Replies

2. Shell Programming and Scripting

How to replace one word across too many files at once

I'm trying to replace the word "core3" with the word "core2" across too many scripts which they all contain that word "core3" (Shell & XML scripts) all at once. Is there easy way with "sed" to do it? Thanks Folks. (2 Replies)
Discussion started by: moe2266
2 Replies

3. Shell Programming and Scripting

Match and replace in different files

Hi, I want to replace the content in 3rd column in the first file by the line in the 2nd file (a list) if matches with 1st column of 2nd file. There are many 1st files in different directories: File1 172.27.1.15 222 I_J_Mar_Sci_34_27.pdf 172.27.28.1 489 Sci_Cult_71_60.pdf... (3 Replies)
Discussion started by: srsahu75
3 Replies

4. Shell Programming and Scripting

compare 2 files and replace

Hi, I have a file which contains names with counts for eg: 0622 0031 JOHN MAX 20080622003104. STAT 1. 0622 0031 BILL MAX 20080622003104. STAT 7. and I have an exception file containing. BILL Can anyone help to write a script... (7 Replies)
Discussion started by: antointoronto
7 Replies

5. Shell Programming and Scripting

Replace a string containing :/=\ in files

I have read many forums about replacing a string in file. I tested but it doesn't work with my string For example I want to replace =x=ks24Y\:LOP= with h\P6qwx:aUE/. Thank you (4 Replies)
Discussion started by: lalelle
4 Replies

6. UNIX for Advanced & Expert Users

Find and Replace from files

Is there any command which I can apply from the command line to find and replace a particular text say "00:00:00:00" with "00" from all the files( where ever this text exists) of the current directory? Thanks in advance (1 Reply)
Discussion started by: cobroraj
1 Replies

7. Shell Programming and Scripting

search and replace in many files

I have a directory full of files. Most of the code in the files is the same accept for a few parameter values. I want to remove hard coded values and replace it with a parameter that I can pass. This is oracle pl/sql anonymous blocks. so the code is similiar to this function myfunc (p_myvar ... (1 Reply)
Discussion started by: guessingo
1 Replies

8. UNIX for Dummies Questions & Answers

Search and replace across files

Hi All, HP-UX oradev3 B.11.11 U 9000/800 3251073457 I have following files all contains text like "919642990137@". I need to search this text across all files and replace it with something like "919717298765@". I was wondering, how to accomplish this task? cpmprod_status.sh... (8 Replies)
Discussion started by: alok.behria
8 Replies

9. Shell Programming and Scripting

Replace values between 2 files

I want to replace the third and fourth lines of a 2nd file by the first two lines of a file. Input: file_1 file_1.line_1 file_1.line_2 file_2 file_2.line_1 <file_2.line_2_blank> file_2.line_3 file2.line_4 <file_2.line_5_blank> Output: file_2.line1 <file_2.line_2_blank>... (1 Reply)
Discussion started by: arpagon
1 Replies

10. UNIX for Beginners Questions & Answers

Find all .sh files in file system and need to replace the string inside .sh files

Hi All, I need to write a script to find all "*.sh" files in /home file system and if any string find "*.sh" files with the name vijay@gmail.com need to replace with vijay.bhaskar@gmail.com. I just understood about the find the command to search .sh files. Please help me on this. find / -name... (3 Replies)
Discussion started by: bhas85
3 Replies
PG_RESULT_SEEK(3)														 PG_RESULT_SEEK(3)

pg_result_seek - Set internal row offset in result resource

SYNOPSIS
bool pg_result_seek (resource $result, int $offset) DESCRIPTION
pg_result_seek(3) sets the internal row offset in a result resource. PARAMETERS
o $result - PostgreSQL query result resource, returned by pg_query(3), pg_query_params(3) or pg_execute(3) (among others). o $offset - Row to move the internal offset to in the $result resource. Rows are numbered starting from zero. RETURN VALUES
Returns TRUE on success or FALSE on failure. EXAMPLES
Example #1 pg_result_seek(3) example <?php // Connect to the database $conn = pg_pconnect("dbname=publisher"); // Execute a query $result = pg_query($conn, "SELECT author, email FROM authors"); // Seek to the 3rd row (assuming there are 3 rows) pg_result_seek($result, 2); // Fetch the 3rd row $row = pg_fetch_row($result); ?> SEE ALSO
pg_fetch_row(3), pg_fetch_assoc(3), pg_fetch_array(3), pg_fetch_object(3), pg_fetch_result(3). PHP Documentation Group PG_RESULT_SEEK(3)
All times are GMT -4. The time now is 07:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy