Search Results

Search: Posts Made By: rony_daniel
5,357
Posted By rony_daniel
Thanks you very much danmero :) It works...
Thanks you very much danmero :)
It works perfect for all the scenarios like 1-4,6... or 1,4-6,....
Now I need analyse what your code is doing.
5,357
Posted By rony_daniel
How to generate a series of numbers
Hi All,

I have a requirement where in I have an input as follows:-
input=1-4,6,8-10,12-15

I need to explode this range into an output file as follows:-
1
2
3
4
6
8
9
10
12
13
14
15...
9,466
Posted By rony_daniel
Difference between if [[ ]] and if [ ] statements
Hi,

Can anyone Please tell me what is the difference between the following variation in the "if loops"

a. if [[ condition ]]
and
b. if [ condition ]

Thanks...
Rony
6,240
Posted By rony_daniel
You are right zazzybob. I got carried away!! ...
You are right zazzybob. I got carried away!!

The variable "a" was not getting populated with the value returned by the expression, with my code.

Your code just works perfect. Once again Thanks.
6,240
Posted By rony_daniel
Thanks zazzybob It worked for me. I did the...
Thanks zazzybob

It worked for me. I did the following:-
a=`expr ${i} + ${j} >> $log_file 2>&1`

Now the error is going to the log file and not to the console. But please tell me what is wrong...
6,240
Posted By rony_daniel
Re-direct the error msg to log file
Hi All,

I have an expression as follows:-
a=`expr ${i} + ${j}` >> $log_file 2>&1

Here, if any of the values i or j or both happens to be empty then the "expr" returns error as
"expr: 0402-050...
56,752
Posted By rony_daniel
Tar multiple files
Hi All,

There 2 files in the folder /temp/tst/
1.txt
2.txt

When I run the command

find /temp/tst \( -name "*.txt" \) -exec tar cf /temp/123.tar {} \;

it creates the tar file 123.tar...
35,272
Posted By rony_daniel
This is working correctly Perderabo. But what if...
This is working correctly Perderabo. But what if I have a directory which inturn have sub-diectories in it. And i want all the files in the parent directory as well as the files in different child...
1,355
Posted By rony_daniel
Another option without sed would be:- ...
Another option without sed would be:-
pattern=$1
var1=`ls -1t $pattern* |head -1`
echo "$var1"

Regards,
Rony
6,549
Posted By rony_daniel
Great aigles !! Both the code suggested by you...
Great aigles !!
Both the code suggested by you is working fine and is excatly what I wanted. I tried this with a huge input file and still it's able to handle it without any errors.

Thank you...
6,549
Posted By rony_daniel
This code have a missing "}". I guess it should...
This code have a missing "}". I guess it should be like this
awk 'substr($0,length($0)) == "," {print substr($0,1,length($0)-1)} substr($0,length($0)) != "," {print $0}' filename
Correct me if I am...
6,549
Posted By rony_daniel
Great aigles !! Thank you very much. This...
Great aigles !!

Thank you very much. This is what I was looking for.

But frankly I didn't understand the code. Could please explain why we are puting line=line $0. Are you concatinating the...
6,549
Posted By rony_daniel
The above command works if I put it like this ...
The above command works if I put it like this

awk 'sub(/$/,""){printf $0;next}' filename>newfilename

But then the output would be
1,2,3,4,5,
The last comma (after 5) should not be there in...
6,549
Posted By rony_daniel
Thanks Jim. But i need to do it with shell script...
Thanks Jim. But i need to do it with shell script itself.

By the way if i change the structure of my source file as
1,
2,
3,
4,
5,
then the above problem of limitaion of length to a single...
6,549
Posted By rony_daniel
Thanks Jim for your quick reply. But for the...
Thanks Jim for your quick reply.

But for the sed command also i am getting it correct if the data is less but when it becomes big (say 1,2,3....5000,) it fails to write to the new file. So the new...
6,549
Posted By rony_daniel
How to delete a character at the end of a file.
I am having a file which has data like this:-
1,2,3,4,5,


But I need to remove the last comma from this file. So the data should be like
1,2,3,4,5


The command I tried was


temp=`cat...
13,445
Posted By rony_daniel
My requirement is if $a > $b then if have to...
My requirement is if $a > $b then if have to execute a set of statements else another set of statements.
if [ `echo "if (${a} > ${b}) 1 else 0" | bc` -eq 1 ]
then
....
.....
else
.....
........
13,445
Posted By rony_daniel
working with bc
Hi vgersh99,

Can you please tell me how to use the else clause in the if statement you have written. (i.e. "if (${a} > ${b}) 1" | bc)" )

so that i will have something like this
"if (${a} >...
Showing results 1 to 18 of 18

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