Search Results

Search: Posts Made By: munna_dude
2,403
Posted By munna_dude
Thanks. it is working
Thanks. it is working
2,403
Posted By munna_dude
Cut the path into two parts
Hi,

file=/usr/lib

I need to cut and put it into two variable like

string1=/usr
string2=lib

I made it for string2

string2=${file#/*/}


How to get String1 in the same way which I...
802
Posted By munna_dude
Command execution from other directory
Hi,

I need to execute some commands in a directory.

script called test.sh from /usr/bin/

and the commands which are there in the script needs to be executed from /etc/ and come back to...
897
Posted By munna_dude
Thanks for noticing. :b:
Thanks for noticing. :b:
897
Posted By munna_dude
Check for strings
Hi,

Please let me know, why the below code is not going to "elif" part.


#! /bin/bash
string1=""
string2="Hello"

echo "string1=$string1"
echo "string2=$string2"
# condition check for...
2,299
Posted By munna_dude
Sorry, I am bit lazy, now onwards I will use...
Sorry, I am bit lazy, now onwards I will use absolute name. we are talking about "rc3.d" directory.

Q: how do I get the value for this "rc3.d" variable name?

A: I have to calculate number of...
2,299
Posted By munna_dude
Hi Don, Sorry, I think I have not conveyed...
Hi Don,

Sorry, I think I have not conveyed the issue properly.

I am not talking about filename which contains "."
Requirement is we have a "rc3.d" dir and it contains some value lets say 12.
...
2,299
Posted By munna_dude
Hi, Thank you all for your time and for...
Hi,

Thank you all for your time and for suggestions provided.

Requirement:
1. I have configuration file which I need to read and parse the required data dynamically.

2. Conf file may...
2,299
Posted By munna_dude
Thanks for quick response and for the information...
Thanks for quick response and for the information provided.

As per my requirements, my file should contains a variable with the name as "r.etc". Is there any hack for this which I can use it in my...
2,299
Posted By munna_dude
String issue
Hi,

Facing a strange problem with the string and also an issue related to trailing space.



# cat test.sh
#! /bin/sh
typeset -a arr

read_params()
{
#while read line
until [ -z "$1" ]...
3,530
Posted By munna_dude
Hi, Thanks for the quick reply. When I...
Hi,

Thanks for the quick reply.

When I try to put it in "eval" command it is not accepting.
Is there any way to use/avoid trailing space here.


eval $value=\"${arr["$value"]}\"

...
3,530
Posted By munna_dude
Remove trailing space
Hi

I am trying to remove trailing space from a string.


value=${value%% }


It is not working. What might be the issue with the above snippet.
2,657
Posted By munna_dude
Hi, Observed a strange behavior from the...
Hi,

Observed a strange behavior from the above code.


arr["$var"]="${arr["$var"]} $val"


above snippet will have the space in front of the text.
It requires if the string having two...
2,657
Posted By munna_dude
Correct but the below error caused to modified it...
Correct but the below error caused to modified it as "-a".
2,657
Posted By munna_dude
Hi, Not able to get the output properly. ...
Hi,

Not able to get the output properly.



#!/bin/bash

typeset -a arr

while read line
do
var="${line%%=*}"
for key in ${line//,/ }
do
...
2,657
Posted By munna_dude
Hi, I tried this logic to read a file and...
Hi,

I tried this logic to read a file and get t he values but no use.


function read_params()
{
until [ -z "$1" ]
do
if [ `expr index "$1" =` != 0 ] ; then
tmp=$1...
2,657
Posted By munna_dude
Hi, Thanks for the solution. When I try...
Hi,

Thanks for the solution.

When I try to apply the code to read a file. I am not getting the proper output.

readfile

temp=/usr=25,/usr/lib=12
bin=12
etc=45
lib=12:6


output...
2,657
Posted By munna_dude
String regular expression
Hi,

temp="/usr=25,/usr/lib=12"

How to get only dir names with out values.

I tried like below but no use.

tmp=${temp##*,}
echo $tmp

o/p:
/usr/lib=12


expected o/p:
/usr /usr/lib ...
1,396
Posted By munna_dude
Hi, Thanks for quick reply, ...
Hi,

Thanks for quick reply,


requirement:
1. runtime a script has to read a file and get the values of "word"
here "word" may contains one or two fields separated by comma,

...
1,396
Posted By munna_dude
Read file and get the data then put it in array
Hi,

I have a file called "readfile" it contains below parameters

#cat readfile

word=/abc=225,/abc/cba=150 three=12 four=45 five=/xyz/yza

likewise multiple line.

From the above file, I...
1,496
Posted By munna_dude
Hi, common words/strings across all the 10...
Hi,

common words/strings across all the 10 files.
That common word should be found in all the 10 files.

---------- Post updated at 03:26 PM ---------- Previous update was at 02:10 PM...
5,960
Posted By munna_dude
Hi, I found this in different posts, might...
Hi,

I found this in different posts, might be helpful

ls -l | grep "Dec 12" | awk '{print $NF}' | xargs grep -l "word"

find . -name "*2012-12-02*" -type f -exec grep -w "word" {} \;
1,496
Posted By munna_dude
Find common words
Hi,

I have 10 files which needs to be print common words from those all files.
Is there any command to find out.
16,242
Posted By munna_dude
Hi Thanks for the reply. I have one more...
Hi
Thanks for the reply.

I have one more doubt, please dont hesitate to answer if it is simple question.

please let me know the below terminology

1. local _var=$PATH/${1#$PATH}
what is #...
16,242
Posted By munna_dude
Shell script if [[ -L <filename> ]]
Hi

Please describe about following condition
if [[ -L <filename> ]]
in shell script.

Also please provide the link related all the flags which are applicable for if condition in Shell
Showing results 1 to 25 of 50

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