Search Results

Search: Posts Made By: alvin0618
3,927
Posted By alvin0618
in my list.txt contain ------------------ ...
in my list.txt contain
------------------
Mary 10
John 20

So, if i the name is not in the list like 'Marcus', it will return 0.
if the name exist in the list like 'John', it will return 20....
3,927
Posted By alvin0618
Why got two value display?
Why got two value display?
3,927
Posted By alvin0618
in my list.txt contain ------------------ ...
in my list.txt contain
------------------
Mary 10
John 20

So, if i the name is not in the list like 'Marcus', it will return 0.
if the name exist in the list like 'John', it will return 20....
3,927
Posted By alvin0618
Something like this (if exist)? echo the value...
Something like this
(if exist)? echo the value : echo 0
3,927
Posted By alvin0618
is it posible to make it ternary if else?
is it posible to make it ternary if else?
3,927
Posted By alvin0618
Yes, i need to write in the shell script. ...
Yes, i need to write in the shell script.

---------- Post updated at 02:22 PM ---------- Previous update was at 02:21 PM ----------



The code you provided is unable to get the answer when i...
3,927
Posted By alvin0618
i want grep the value based on the name. If the...
i want grep the value based on the name. If the name does not exist in the file return 0 ( mean grep nothing).
3,927
Posted By alvin0618
grep -c "Marcus" list.txt | awk '{print $2}' ...
grep -c "Marcus" list.txt | awk '{print $2}'
it displays nothing.


What i want is
if i cant grep the keyword then
display zero
else
display the value

in a single line of code.
3,927
Posted By alvin0618
grep word
grep 'Marcus' list.txt | awk '{print $2}'


list.txt
Mary 10
John 20

How do i write if grep nothing then return zero instead of display nothing in the line.
2,345
Posted By alvin0618
This is what i got grep: illegal option -- m...
This is what i got

grep: illegal option -- m
Usage: grep -hblcnsviw pattern file . . .

May i know where did i do wrong?
2,345
Posted By alvin0618
Check a specific word whether is in file
I want to valid a specific word whether it is contained in the text file. For example:

family.txt
father
mother
son
sister

if ("father" contain in family.txt)
do some process
else
...
4,738
Posted By alvin0618
Hi, ctsgnb Thanks for your reply. If i dont...
Hi, ctsgnb
Thanks for your reply.
If i dont know the rows number in text, can it be captured based on the first value of a11111 ( like an unique value )?
4,738
Posted By alvin0618
Hi, ichaelrozar17 Thanks for the reply. It...
Hi, ichaelrozar17
Thanks for the reply. It works perfectly.
4,738
Posted By alvin0618
Hi, cgkmal. Thanks for the reply. I follow...
Hi, cgkmal. Thanks for the reply.

I follow the code you provide
the system prompts this errors

awk: syntax error near line 1
awk: illegal statement near line 1
awk: syntax error near line 4...
4,738
Posted By alvin0618
Edit file content at the specific line.
How to edit file content at the specific line? For example at below

The things to edit --> This is line 2. And it is below line 1.


This is line 1.
This is line 2. # i want to...
3,565
Posted By alvin0618
I need crossover others platform between GNC and...
I need crossover others platform between GNC and Suns. Suns can't run this code. Do you have other solution? Kindly appreciate your reply. TQ
3,056
Posted By alvin0618
Problem in echo value after some calculation
val=21
total=3250
echo "`echo "scale=2; $val*100/$total" | bc`"

Output:
.64


How do i show the output become "0.64" instead of ".64" ?? Someone can help?
3,565
Posted By alvin0618
Can the date get from current date from system ?
Can the date get from current date from system ?
3,565
Posted By alvin0618
Generate last hour date in YYYYmmddHH
can some one show me how to generate last hour of date for example:
2012010100 -> 2011123123 // check first date of a new year
2008030100 -> 2008022923 // check leap year as well
And also no...
5,848
Posted By alvin0618
Thank you. pravin27
Thank you. pravin27
5,848
Posted By alvin0618
how you show me how to store this result into a...
how you show me how to store this result into a variable $target_date ?
5,848
Posted By alvin0618
I am using SunOS LSMS 5.10 .
I am using SunOS LSMS 5.10 .
5,848
Posted By alvin0618
Show previous hour
date +%Y%m%d%H

output :
2011031415

I want to get previous hour like this 2011031414. Any one can help ?
7,507
Posted By alvin0618
I'm sorry i cant get it, i can't get it. If like...
I'm sorry i cant get it, i can't get it. If like the this how to run ? is it a function type?

{
echo "scale=2; $val1*100/$total" | bc
echo "scale=2; $val2*100*100/$total" | bc
...
7,507
Posted By alvin0618
May i know why got curly bracket?
May i know why got curly bracket?
Showing results 1 to 25 of 29

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