*I am Getting input and mailing it.
*Its Working Fine!! Jus wanted to know is thr possibility of improvement in this code.
*The number of lnes must be minimum and code must be effective.
Awaiting for new ideas and suggestion to improve the code since i am very new to unix.
Last edited by wasim999; 06-13-2014 at 04:13 AM..
Reason: Add CODE tags.
The `pwd` means it relies on the output of an external program.
Better use . for "current directory", i.e. ./Focus or just Focus.
If you use a multi-line string, you can rewrite the file in one stroke, and also avoid a non-portable \n - and increase readability!
Maybe you can omit the use of the Focus file by means of a pipe:
Last edited by MadeInGermany; 06-19-2014 at 04:24 AM..
*The number of lnes must be minimum and code must be effective.
What kind of measurement is this? I often end up writing a 100-line script to execute what is basically a oneliner. I add all sorts of checks (additional commands) and error handling (even more commands) to it, let the script write logs (more commands on top), but i don't suppose the script to be less good or less effective afterwards.
Of course i could execute the one core line instead and if everything works right it would effectively do the same as the 100-line script. Is the script ineffective therefore? Not at all.
So, what do you mean by "minimum number of lines"?
bakunin
These 2 Users Gave Thanks to bakunin For This Post:
Below script is used to search numeric data from around 400 files in a folder. I have 300 such folders. Need help in performance improvement in the script.
Below Script searches 20 such folders ( 300 files in each folder) simultaneously. This increases cpu utilization upto 90% What changes... (3 Replies)
Hi All,
Here is my script
#! /bin/sh
var1=some email id
var2=some email id
grep -i "FAILED FILE FORMAT VALIDATION" /opt >tmp2
diff tmp1 tmp2 | grep ">" >tmp3
if
then
cat tmp3 | mailx -s " Error Monitoring" $var2
else
echo "Pattern NOt Found" | mailx -s " Error Monitoring" $var1... (1 Reply)
can anyone help to share the knowledge on linux os improvement?
1) os account
- use window AD authentication, such as ldap, but how to set /etc/passwd, where to put user home?
2) user account activity
- how to log os user activity
share the idea and what tools can do that...thx (5 Replies)
I write reports daily to a directory that is named with the month and year. I wanted to compress all but the last two months worth of these directories to save space. I am going to cron a job to run on the first of each month to do this clean up. I didn't have zip/unzip on my AIX environment so... (0 Replies)
Hi!
Thank you for the help yesterday
This is the finished product
There is one more thing I would like to do to it but I’m not to certain
On how to proceed I would like to log all output to a log in order to
Be able to roll back
This script is meant to be used in repairing a... (4 Replies)
Hi All,
I have written a script which does some editing in the files, based on user input.This might not be the most elegant way of doing it and there would be many improvements needed.
Please go through it and let me know how it could be improved.
Suggestions are welcome!!
Thanks!... (2 Replies)
Hi All
I am reading a huge file of size 2GB atleast. I am reading each line and cutting certain columns and writing it to another file.
Here is the logic.
int main()
{
string u_line;
string Char_List;
string u_file;
int line_pos;
string temp_form_u_file;
... (10 Replies)