Search Results

Search: Posts Made By: Rock
30,133
Posted By Rock
Thanks a lot
Thanks a lot
30,133
Posted By Rock
I am using shell script. I tried to use "sort...
I am using shell script. I tried to use "sort -u", but it seems to be not working.
30,133
Posted By Rock
Remove duplicate in array
Hi,

I have a list of numbers stored in an array as below.

5 7 10 30 30 40 50

Please advise how could I remove the duplicate value in the array ?

Thanks in advance.
2,409
Posted By Rock
yes thanks
yes
thanks
2,409
Posted By Rock
I have amended the script as below. rc=`expr...
I have amended the script as below.

rc=`expr ${rc1}` || `expr ${rc2}` || `expr ${rc3}`


But the following error prompted.

/work/proj/projtmp/testing.sh[3]: 1: not found.


Please give...
2,409
Posted By Rock
OR expression
Hi all,

I want to perform 'OR' for the following 3 variables.

rc1=1
rc2=1
rc3=1

rc=`${rc1} \| ${rc2} \| ${rc2} `

How can it be done?

Thanks,
Rock
124,102
Posted By Rock
yes ... thank you
yes ... thank you
124,102
Posted By Rock
If..elif..else...fi
Hi all,


I got some problems on executing the following scripts.

Scripts:
if [[ ${var1} == 1 ]]; then
echo "M${str}O 0 1" >> ${tempFile}
elif [[ ${var2} == "U"]]; then
echo "M${str}O 1...
2,702
Posted By Rock
thanks a lot
thanks a lot
2,702
Posted By Rock
From File to Array
Hi all,

I want to store the records from a file to an array. What approach can I use?

e.g.
soruce_file:
aaa
bbb
ccc

array:
arr[0]=aaa
arr[1]=bbb
arr[2]=ccc


Thanks,
Rock
11,894
Posted By Rock
Using variable inside 'sed'
Dear all,


How can I amend the following command to use variable inside 'sed' ?

str=`sed -e 's/orig_string/${var}/g' ${sourcefile}`


Thanks,
Rocky
61,231
Posted By Rock
Remove Line Break
Dear all,


Please advise what approach can remove all line break from a text file?
e.g.
Source file:
A
B
C

Target file:
A, B, C


Thanks,
Rock
3,394
Posted By Rock
I can extract all strings start with abc (like...
I can extract all strings start with abc (like abc*) with the symbol '^'. Is there any similiar method to handle the wildcard situation?

e.g.
cat /home/source_file.dat | awk -f /home/filter.awk...
3,394
Posted By Rock
Disable wildcard
Hi,


Please advise how can I modify my command to extract all strings with exact match only (no wildcard character).

Command:
cat /home/source_file.dat | awk -f /home/filter.awk criteria1=abc...
10,487
Posted By Rock
Similiar error prompted by using 'ex' $ ex...
Similiar error prompted by using 'ex'

$ ex large.dat
"large.dat"ex: 0602-026 No more memory for the append. Too many lines in the file.


I would like to amend the first few matched pattern...
10,487
Posted By Rock
Editing a large size file
I would like to edit a doc which is large file size. I can't use "vi" command due to out of memory.


$ vi large.dat

ex: 0602-101 Out of memory saving lines for undo.


Please help. Thanks.
11,982
Posted By Rock
i can solve it Thanks
i can solve it
Thanks
11,982
Posted By Rock
For the sed solution, The Pattern is...
For the sed solution,


The Pattern is constructed with a variable string inside a text.
e.g.
aaa123aaa
aaa4 5aaa
aaa678aaa

sed -e "s/aaa*aaa/&$str/g" ${source_file}

Why I can't use "*"...
11,982
Posted By Rock
I have writen a simple script to arhieve my...
I have writen a simple script to arhieve my purpose. However, "There is not enough memory available now" is prompted. Can my script be optimized to reduce resource? Thanks.

append_string=`cat...
3,053
Posted By Rock
Put content of file into variables
How to put a line of strings (with some white spaces in between) from a file into variables?

I have tried the following codes. However, the content is cut by space (not by line)


for i in `cat...
11,982
Posted By Rock
Append string in all rows
I would like to append a string at the end of each row of a .dat file.
please give me some advice? Thanks.

e.g.
#content in abc.dat
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
5,759
Posted By Rock
It's great. Thank you.
It's great. Thank you.
5,759
Posted By Rock
get value from AWK
Hi,


I have written a simple script to grep some lines from a text file with "awk".
e.g. cat <text> | awk ....
sample output:
1234567
890
I can get the result successfully.

However,...
Showing results 1 to 23 of 23

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