Search Results

Search: Posts Made By: hkansal
9,037
Posted By hkansal
hmmm... Thanks everyone for the replies. I...
hmmm...

Thanks everyone for the replies. I think I should go with what Zaxxon told me earlier and as I had initially done it. I don't require functions because only single line of code, so that...
1,596
Posted By hkansal
Hello, I mean, I would just like to use them...
Hello,

I mean, I would just like to use them as a "notation" for variables that are available to every scope; outside any function.

I knew you would be replying, saw you online :)

Thank You....
1,596
Posted By hkansal
"_" in variable names
Hello Experts,

I have written a UNIX shell which spans about 400 lines. I have tried to manage the flow as far as possible using functions. In the main shell flow, there are certain variables, not...
9,037
Posted By hkansal
Hello Zaxxon, Thank you for confirming that...
Hello Zaxxon,

Thank you for confirming that my thought process was correct. :)

Let us consider the code you gave, I want to avoid writing "my_func2" twice. Can we do that?

Thank You.
...
2,588
Posted By hkansal
I suppose data.txt is the filename: ...
I suppose data.txt is the filename:


cid="CID342"
newVal="007"

set -A arrVals `grep "${cid}" data.txt | awk '{print $1" "$2" "$3}'`
sed "s/${cid} .*/${arrVals[0]} ${arrVals[1]} ${newVal}/g"...
2,675
Posted By hkansal
It is a good practice to check for uninitialized...
It is a good practice to check for uninitialized variables in a shell.

$logfile would have hopefully been caught in that.

Regards,
HKansal
39,281
Posted By hkansal
Not Really!! It has to be a 2 step process. ...
Not Really!!

It has to be a 2 step process.

Just in case you are looking to unzip a .zip file, the jar command would do it.

Regards,
HKansal
9,037
Posted By hkansal
Fall through case structure
Hello Experts,

I was wondering how can we get a fall trough case structure.
Eg: If we have two cases A and B and a default; if I do not break after A, it should execute all the statements of A as...
2,690
Posted By hkansal
Damn!
I can only be sorry I did that to myself. So careless.

Thank you Franklin.

Regards,
HKansal
2,690
Posted By hkansal
String Arithmetic ?
Hello Experts,

In my shell I need to perform some simple subtraction on a value returned as a result of the "wc" command. The code:


scanFromLine="100" ## This is returned as string as a...
13,087
Posted By hkansal
Please post the script in CODE tags
Please post the script in CODE tags
4,910
Posted By hkansal
you are most probably missing a quote (")...
you are most probably missing a quote (") somewhere
1,921
Posted By hkansal
Hello, I am not sure but maybe these links...
Hello,

I am not sure but maybe these links tell what you are looking for:
Link 1 (http://www.linuxquestions.org/questions/linux-software-2/emacs-changing-default-font-size-and-font-type-489000/)...
12,183
Posted By hkansal
yes, you might have rwx permissions for all on...
yes, you might have rwx permissions for all on YOUR file, where you have it.
But you need to have write permissions on the remote servers folder where you are trying to put this file AND you also...
6,271
Posted By hkansal
code
Here I would say "good job Rakesh" as you captured the logic I stated earlier.

But I would have considered it better to give that step wise. Anyways, the job's done I guess.

Regards,
HKansal
6,271
Posted By hkansal
Logic
Hello,

Here is a logic that you can use. Try to implement it and ask if you have problems constructing the statements.

1. List al the log filenames.
2. add the names to an array.
3. loop...
3,408
Posted By hkansal
refer
Vero,

Please refer to the thread - here (https://www.unix.com/shell-programming-scripting/107698-sed-place-char-starting-replace-selected-line.html#post302324518) -

Might be of some help to you....
30,219
Posted By hkansal
Final Script
Hello,

I am posting the final script created under the initial thread :here...
26,127
Posted By hkansal
Final Script
Hello,

I am posting the final script created under the initial thread :here...
3,733
Posted By hkansal
Final Script
Hello,

I have posted the final script under the initial thread :here (https://www.unix.com/shell-programming-scripting/107698-sed-place-char-starting-replace-selected-line.html#post302324518):
...
18,814
Posted By hkansal
Final Script
Hello Experts,

Here is the final script:


#############################################################
##
## Shell : hDeploy
##
## Author : Himanshu Kansal
##
## Date :...
30,219
Posted By hkansal
Works
Hello,

Hey Ghostdog, that worked as good as you were sure about it. Thanks.
Also, for letting me know something more about "awk".

Any way to do it through sed, just for my information and...
30,219
Posted By hkansal
Hello, Yes Franklin, as rightly said by you,...
Hello,

Yes Franklin, as rightly said by you, that I can identify. The "c1" part is the only thing that I would know and it is unique, so locating the line is not a problem.

I want to make my...
30,219
Posted By hkansal
sed: remove first character from particular line
Hello Experts,

I have a file "tt.txt" which is like:

#a1=a2
b1=b2
#c1=c2
I need to remove the pound (#) sign from a particular line. In this case let us assume it's 3rd line : "#c1=c2"

I...
11,648
Posted By hkansal
building blocks
Hello,

As far as I understand, now you want to know the latest file modified.

try:
ls -lrt

this would give u the files in the descending order of "Date Modified"
do a head -1 to get the...
Showing results 1 to 25 of 66

 
All times are GMT -4. The time now is 08:02 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy