Search Results

Search: Posts Made By: indianjassi
21,654
Posted By indianjassi
Thanks to all for the replies. The solutions...
Thanks to all for the replies.
The solutions given by Franklin and ahmad(second one) is most suited to me, since i need a generic expression, not something that is specific (eg. IP address only).
...
21,654
Posted By indianjassi
Thanks Franklin52 Can you please explain...
Thanks Franklin52

Can you please explain the logic? I didn't quite understand the use of square brackets.
21,654
Posted By indianjassi
I want a solution that has no dependency on other...
I want a solution that has no dependency on other columns, because as i said that my input string will have variable columns.
21,654
Posted By indianjassi
sed remembering part of pattern using \1 concept
I am using this concept to fetch value of IP address after node= in this line of csv text:

...
10,593
Posted By indianjassi
Sed does not make changes in the file but to the standard output
I have an xml file.
I am doing some change, say deleting line 770. File name is file.xml. I use:

sed '770d' file.xml

but this does not actually make changes in the *file* but shows the changes...
2,685
Posted By indianjassi
counter=0 cat size | while read a do if [...
counter=0
cat size | while read a
do
if [ counter="1" ]
then
cmp2=`echo $a | awk -F " " '{print $5}'`
fi
else
cmp1=`echo $a | awk -F " " '{print $5}'`
elif
counter=`expr{counter+1}`
done
...
5,742
Posted By indianjassi
Thanks for detailed explanation, bakunin! ...
Thanks for detailed explanation, bakunin!


No there was a slight problem, I figured out myself why this didn't work:
node=`echo $node | sed 's!/!\\/!g'`
echo $node
a/b/c
I needed to put...
5,742
Posted By indianjassi
OK a question: Why this doesnt work: ...
OK a question:



Why this doesnt work:
node=`echo $node | sed 's!/!\\/!g'`
echo $node
output: a/b/c

But this works
echo $node | sed 's!/!\\/!g'
output: a\/b\/c
5,742
Posted By indianjassi
Thanks How does this work? Can you please...
Thanks
How does this work? Can you please explain.
5,742
Posted By indianjassi
How to substitute "\" by "\/" using SED?
Input: a/b/c
Output required: a\/b\/c

This does not work:
sed s/'\/'/'\//'/g
1,361
Posted By indianjassi
AWK problem :(
I have this simple awk statement:

awk -F "," '/'"$node"'/ {print$0}' temp1.csv > temp.csv

Now consider the following cases:
case1:
$node=ABC-ind.aus.in.chi.gcp.net
and
temp1.csv:...
2,195
Posted By indianjassi
Manipulating a variable across multiple shell scripts
I have a shell script similar to:

#!/bin/sh
a=1
source a1.sh -- Modifies a
source a2.sh -- Modifies a
echo "After execution, value of a is $a"

What i need is a1.sh script modify the same...
9,776
Posted By indianjassi
First tell us what you have tried. So that...
First tell us what you have tried.

So that we can suggest you improvement..
4,205
Posted By indianjassi
Its not fetching the correct value. defnfile is...
Its not fetching the correct value.
defnfile is a shell variable, not awk variable...
4,205
Posted By indianjassi
Using two shell variables in single AWK statement
meas is a shell variable, and this works perfectly fine for me:

awk -v var=$meas -F, '$1==var' /abcd/efgh.txt > temp1.csv

However, i want to introduce another shell variable, named, defnfile in...
1,915
Posted By indianjassi
I suppose you meant this awk -F "," '$1 ==...
I suppose you meant this

awk -F "," '$1 == "$meas"' defn.csv > temp.csv

No, its not fetching anything... :(
1,915
Posted By indianjassi
Help with Awk
I have this following statement:

awk -F "," '/'"$meas"'/ {print$0}' defn.csv > temp.csv

$meas variable has been taken care of to fetch a variable from user.

My defn.csv file containes these...
1,583
Posted By indianjassi
Thanks. It worked. Could you explain me where i...
Thanks. It worked. Could you explain me where i went wrong?
1,583
Posted By indianjassi
Why this behaviour of IF condition?
I have a variable, defndata, which is a number (fetched from a file using awk).

I want that if defndata is not initialized (that is its not found in the file using awk), then to execute a block of...
2,525
Posted By indianjassi
yes it works! And thanks for the tip.
yes it works!

And thanks for the tip.
2,525
Posted By indianjassi
I am using ksh. Do you mean to use this: ...
I am using ksh.

Do you mean to use this:

if [[ ($dumpdata -eq $defndata) || (($dumpdata -le $compare1) && ($dumpdata -ge $compare2)) ]]
2,525
Posted By indianjassi
Whats wrong with this IF condition?
I have four variables, dumpdata, defndata, compare1 and compare2

I want an IF statement condition which returns true when either dumpdata=defndata or (dumpdata<=compare1 and dumpdata>=compare2). ...
1,900
Posted By indianjassi
Stupendous! Works like a charm, Thanks! If...
Stupendous!
Works like a charm, Thanks!

If you dont mind, can you just explain a little bit of that sed command you used, agn?

I have a beginner level of understanding. What i read in a book...
1,900
Posted By indianjassi
Extract info from csv
I have some input file, which contains some lines which are comma separated. Eg.

a,b,id=999],d
d,f,g,id=345],x
x,y,x,s,id=677],y

I run a loop to read the lines one by one. What i want is to...
Showing results 1 to 24 of 24

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