08-27-2012
Pls explain a bit more. sed needs an input stream which it does not see if used in your example's for loop; it's reading stdin instead. So sth. like ls|sed... could work on a directory, but then, what variable (i) do you want to use? I guess you need two loops on two different directories, one producing the input stream and the other the variables to replace certain parts of that stream?!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
hi,
i need to replace a line a file with a new raw device location..
original file..
/opt/sybase/ASE1502/ASE-15_0/bin/dataserver \
-d/data/TST_AKS1/sybdevices/master.dat \
-e/logs/sybase/TST_AKS1/SFO_TST_AKS1.log \
-c/apps/sybase/ASE1502/ASE-15_0/TST_AKS1.cfg \... (2 Replies)
Discussion started by: aksaravanan
2 Replies
2. Shell Programming and Scripting
I have to update a paramater (dateMemLimit) present in a file, with a date (YYYYMMDD) equal to 5 days before the sysdate. The parameter will be in the following format.
dateMemLimit = 20091201
Please note the blank spaces present between 'dateMemLimit' &'=' and between '='... (4 Replies)
Discussion started by: rajesh8s
4 Replies
3. Shell Programming and Scripting
e.g.
/home/$USER/.config replace it with "" (empty)
Is this possible?
I think you should play a bit with sharps ## and sed:b: (2 Replies)
Discussion started by: hakermania
2 Replies
4. Shell Programming and Scripting
Hello all
I have a file with a lot of records...Each one have a ID like this:
000000001 LDR L -----nam--2200217Ia-45e0
000000001 891
000000001 892
000000001 893
and so on
then you have the second record:
000000002 LDR L -----nam--2200208Ia-15e0
000000002 891
000000002... (5 Replies)
Discussion started by: ldiaz2106
5 Replies
5. Shell Programming and Scripting
Hi,
I have two files
file1 :>
val="10"
port="localhost:8080"
httpadd="http:\\192.168.0.239"
file2 :>
val=${val}
port=${port}
httpadd=${httpadd}
fileloc=${fileloc}
file3(or file2) should have following output(input from fileone)
file3 (8 Replies)
Discussion started by: nitin.pathak
8 Replies
6. Emergency UNIX and Linux Support
Guys I have a big issue that I need to get fixed ASAP however I can not seem to find a way to do it. We started to use zones with Solaris 10 at work and we moved a zone from a SIT box to a DEV box. Problem is the software we have installed is looking at a /lcl/sit/apps/ path and it needs to look... (5 Replies)
Discussion started by: LRoberts
5 Replies
7. Shell Programming and Scripting
Hi All,
How can i find and replace the one path to another path with in the file.
For Example:
Search_path=/search/path
replace_path=/replace/path
I used the following command but not usefull, please help me regarding the same.
sed 's_/search/path_/replace/path_' file_name >... (6 Replies)
Discussion started by: nsyed.dw
6 Replies
8. Shell Programming and Scripting
Hi,
I have a file such that:
tart*)*98'bank'ksb64bank)(tart2d&f44bank
I want to replace to: (only between tart and bank)
tart*)*98'replaced'ksb64bank)(tart2d&f44replaced
Thanks. (6 Replies)
Discussion started by: tara123
6 Replies
9. Shell Programming and Scripting
Hi All,
I have a file as shown below: myFile.dat
#----------------------------------------------------------
dataFile
{
Name shiva;
location Delhi;
travelID IDNumber;
}
4
(
560065
700007
100001
200002
)... (8 Replies)
Discussion started by: linuxUser_
8 Replies
10. Shell Programming and Scripting
Hi,
I need to do find and replace, but the pattern is not full known.
for example,
my file has /proj/app-d1/sun or /data/site-d1/conf
here app-d1 and site-d1 is not constant. It may be different in different files. common part is /proj/xx/sun and /data/xxx/conf
i want to find where ever... (6 Replies)
Discussion started by: rbalaj16
6 Replies
getc(3s) getc(3s)
Name
getc, getchar, fgetc, getw - get character or word from stream
Syntax
#include <stdio.h>
int getc(stream)
FILE *stream;
int getchar()
int fgetc(stream)
FILE *stream;
int getw(stream)
FILE *stream;
Description
The function returns the next character from the named input stream.
The function is identical to (stdin).
The function behaves like but is a genuine function, not a macro. It may be used to save object text.
The function returns the next word (in a 32-bit integer on a VAX-11 or MIPS machine) from the named input stream. It returns the constant
EOF upon end of file or error, but since that is a good integer value, feof and should be used to check the success of The assumes no spe-
cial alignment in the file.
Restrictions
Because it is implemented as a macro, treats a stream argument with side effects incorrectly. In particular, `getc(*f++);' doesn't work as
expected.
Diagnostics
These functions return the integer constant EOF at end of file or upon read error.
A stop with message, `Reading bad file', means an attempt has been made to read from a stream that has not been opened for reading by
See Also
fopen(3s), fread(3s), gets(3s), putc(3s), scanf(3s), ungetc(3s)
getc(3s)