Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Sham Jowsaki

Ranch Hand
+ Follow
since May 22, 2001
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Sham Jowsaki

Hi All,

I have written a smal .bash script which is started perfectly and keep running. Now I would like to stop this script.

How to do that? Please help me. Urgent.

Thanks
Jowsaki
15 years ago
Hi All,

What is the best to set .sh script (bash) to run it 24x7 on solaris system.

Please advise me.

Thanks
Sham
15 years ago
Hi All,
There is a multiple directories which had bunch of files (.txt), where I would like to read the (.txt) file n append some lines on each file using shell script.
Could you pls guide me how to do this n provide the sample script.
Thanks in advance.
Cheers
Jowsaki
16 years ago
I solved the problem n Thanks for your reply.
I was having a problem with writing the updated line n rest of the lines, for which I saved as different filename n append the lines.
But my actual requiredment is that to save in the same filename, If you can pls alter my code n advise me.
Here is my code store as a different filename..
Thanks
Cheers
Jowsaki
public void updateCOD(String codfile)
{
System.out.println("Inside UpdateCOD ");
try
{
FileReader codFile = new FileReader(codfile);
BufferedReader br1 = new BufferedReader(codFile);
// Read the first line from the file.
String line1 = br1.readLine();
// As long as the line isn´┐Żt null, keep going.
while ( line1 != null )
{
// extract integers from a text file, then do the caculation.
System.out.println("Line1 is "+line1);
if(line1.trim().equals("COD-Type:image/gif"))
{
line1="COD-Type:image/jpeg";
}
try {
BufferedWriter out = new BufferedWriter(new FileWriter(codfile+".bak",true));
out.write(line1);
out.write("\n");
out.close();
} catch (IOException e) {
}
line1 = br1.readLine();
}
br1.close();
codFile.close();
}
catch(FileNotFoundException fne)
{
fne.printStackTrace();
}
catch(IOException ioe)
{
ioe.printStackTrace();
}
}
16 years ago
Its about 5 lines..
pls find below the format
COD-Type:image/gif
COD-Size:26241
COD-URL:http://xyz/230116.gifOD-Description:welcome ft
COD-Name:welcome ft
eg. image/gif need to be changed as image/jpeg
Pls give me an example.
Tks
Jowsaki
16 years ago
Hi All,
I have .txt file which I need to read linebyline and find the specific line n replace as different line and then save as same filename.
Could you please help me out
Thanks
Cheers
Jowsaki
16 years ago
Hi All,
I hv requirement like find n replacement a word in a file but the filenames are limited and the filesnames list are updated in one files.
like (fn.txt has all filenames has to be changed)
aa
bb
cc
xx
yy
zz
now I have to read this file and do the below process only on those files.
perl -pi.bak -e 's/\bFIND/REPLACEMENT/g' $(find dir -name '*.txt')

Can you please help me out in this regards
Thanks
Cheers
Jowsaki
16 years ago
Hi Leslie,
Thanks for all your support.
I hv requirement like this (find n replacement) but now the filenames are limited and the filesnames list are updated in one files.
like (fn.txt has all filenames has to be changed)
aa
bb
cc
xx
yy
zz
now I have to read this file and do the below process only on those files.
perl -pi.bak -e 's/\bFIND/REPLACEMENT/g' $(find dir -name '*.txt')

Can you please help me out in this regards
Thanks
Cheers
Jowsaki
[ December 12, 2003: Message edited by: Sham Jowsaki ]
16 years ago
Thanks Leslie,
It works perfectly..
Cheers
Jowsaki
16 years ago
Sorry it is not working n givin an error as cannot execute.
sh: ./2/231825.txt: cannot execute
16 years ago
Hi Leslie,
If I want to change the filename in multiple directories.
Say (*.txt to *.lcd)
Thanks
Cheers
Jowsaki
16 years ago
Hi,
THanks for your response.
Yes, the second command is works fine, if I define the dir name.
Cheers
Jowsaki
16 years ago
Hi All,
I would like to know how to find n replace the word in files the particular file format which is avail in different directories. The file should be identify by using the file extention (.txt).
I know using shell script we can achieve this task. Can anyone help me out.
Thanks
Cheers
Jowsaki
16 years ago
Hi All,
I have a unix box which is running on Solaris OS. I would like to know how to startup automatically
weblogic and oracle applications when I reboot the system?
Is there any way to configure the system? Pls advise me
Thanks
Regards
Cheers
Jowsaki
16 years ago
Hi All,
I have a unix box which is running on Solaris OS. I would like to know how to startup automatically weblogic and oracle applications when I reboot the system?
Is there any way to configure the system? Pls advise me
Thanks
Regards
Cheers
Jowsaki
16 years ago