Search Results

Search: Posts Made By: acmvillareal
9,060
Posted By acmvillareal
Try mine. Not a one-liner though.
Try mine. Not a one-liner though.
9,060
Posted By acmvillareal
FILE_PATH="<write the path here>" ...
FILE_PATH="<write the path here>"
FILE1="${FILE_PATH}/S5_SK1.chr01"
FILE2="${FILE_PATH}/S5_SK1.chr02"
FILE3="${FILE_PATH}/S5_SK1.chr03"
BASENAME1=`basename ${FILE1}`
BASENAME2=`basename...
24,813
Posted By acmvillareal
#!/usr/bin/sh INPUT=$1 COUNT=${INPUT} ...
#!/usr/bin/sh

INPUT=$1
COUNT=${INPUT}

while [ ${COUNT} -ne "1" ]
do
COUNT=`expr ${COUNT} - 1`
INPUT=`expr ${INPUT} \* ${COUNT}`
done

echo ${INPUT}
1,472
Posted By acmvillareal
sddDVM12312373069 echo sddDVM12312373069...
sddDVM12312373069


echo sddDVM12312373069 | sed 's/DVM/"DVM"/' | sed 's/73069/"73069"/'


Output:

sdd"DVM"123123"73069"
1,018
Posted By acmvillareal
The Case statement will already verify if the...
The Case statement will already verify if the parameter is valid or not - whether the parameter is int or char. If the parameter is composed of characters, then the Case statement will select the (*)...
2,933
Posted By acmvillareal
sed q | sed "s/^/'/" --> for the first line ...
sed q | sed "s/^/'/" --> for the first line

sed '$!d' | sed "s/^/'/" --> for the last line
14,220
Posted By acmvillareal
grep <string> $TMPFILE cat $TMPFILE | sed...
grep <string> $TMPFILE

cat $TMPFILE | sed '/<string>/!d'

cat $TMPFILE | sed -n '#p' ---> # refers to the line number
14,220
Posted By acmvillareal
Maybe it's better if you use grep or sed.
Maybe it's better if you use grep or sed.
2,611
Posted By acmvillareal
Anytime.:b:
Anytime.:b:
2,611
Posted By acmvillareal
1.txt G1='0318' G2='0023' G3='3092' ...
1.txt
G1='0318'
G2='0023'
G3='3092'
G4='0014'


#!/bin/sh

C=1

while read LINE
do
if [ $C -le 4 ]
then
G="G$C"
A=`echo $LINE | awk '{print substr($0,5,4)}'`
echo "Group=$G...
5,419
Posted By acmvillareal
Search the current directory find . -size...
Search the current directory
find . -size +750k -ls

Search all directories
find / -size +750k -ls
949
Posted By acmvillareal
cat <file> | tr ' ' '\n' 1.txt I Want this...
cat <file> | tr ' ' '\n'

1.txt
I Want this line to look like this.

[******@******** home]$ cat 1.txt | tr ' ' '\n'
I
Want
this
line
to
look
like
this.
5,359
Posted By acmvillareal
Hey man, you got the code wrong. Change the...
Hey man, you got the code wrong. Change the single quote in W to `.


W=`whoami`
DATE=`date "+%Y-%m-%d %H:%M:%S"`

echo " $DATE- by $W"


Output:
2011-03-29 10:18:36- by ******
4,101
Posted By acmvillareal
This is it. #!/bin/sh STR=`grep $1...
This is it.


#!/bin/sh

STR=`grep $1 1.txt | awk '{ print $2 }'`

if [ -z $STR ]
then
echo "0"
else
echo $STR
fi





---------- Post updated at 04:21 PM...
4,101
Posted By acmvillareal
Try this sir. #!/bin/sh STR=`grep $1...
Try this sir.


#!/bin/sh

STR=`grep $1 1.txt | awk '{ print $2 }'`

if [ -z $STR ]
then
echo "0"
else
echo $STR
fi
4,101
Posted By acmvillareal
Sir, whatever the input will be, the code will...
Sir, whatever the input will be, the code will output the "0".
4,101
Posted By acmvillareal
grep -c $1 1.txt if [ $? -ne "0" ] ...
grep -c $1 1.txt

if [ $? -ne "0" ]
then
echo "0"
else
echo $1
fi
4,101
Posted By acmvillareal
Three separate if..else statements? Or, nested if...
Three separate if..else statements? Or, nested if statement? Can you please expound.
4,101
Posted By acmvillareal
Program: $1 can be Marcus or any input you...
Program:

$1 can be Marcus or any input you want to find in the file

grep -c $1 1.txt

if [ $? -ne "0" ]
then
echo "0"
fi
4,101
Posted By acmvillareal
Do you want the script in the command line or...
Do you want the script in the command line or inside a program?
4,101
Posted By acmvillareal
Don't put the awk part. Just the grep. ...
Don't put the awk part. Just the grep.

[******@******** home]$ grep -c "Marcus" 1.txt
0
4,101
Posted By acmvillareal
I don't know how to display a certain string when...
I don't know how to display a certain string when the grep did not find a match. But the code below will output zero (instead of nothing) if there is no match.

grep -c "Marcus" list.txt
2,863
Posted By acmvillareal
The reason why I put that script is because you...
The reason why I put that script is because you didn't put the extension file in the file name.


FILE_NAME="new_applicant_list"
2,863
Posted By acmvillareal
SCRIPT_PATH="/u01/app/banner/test/skid/plus/" ...
SCRIPT_PATH="/u01/app/banner/test/skid/plus/"
FILE_PATH="/nfs/mercury/u03/banner/test/skid/log/"
LIST_FILE_PATH="/u01/banjobs/TEST/"
SCRIPT_NAME="szpcal1.sql"
FILE_NAME="new_applicant_list"
...
2,631
Posted By acmvillareal
Hey man, if would do this problem, I would just...
Hey man, if would do this problem, I would just make a new file and append each line of both files and make an if statement. That is because I'm just a beginner. But I want to learn more about the...
Showing results 1 to 25 of 28

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