Search Results

Search: Posts Made By: franksunnn
1,576
Posted By franksunnn
So how about my question? How to pass the array...
So how about my question? How to pass the array as argument to the function?
:):)
1,576
Posted By franksunnn
Question about sorting -- how to pass an array to a function
Hi, guys

I just wanted to sort the elements of an array ascendingly.
I know the following code does work well:

array=(13 435 8 23 100)
for i in {0..4}
do
j=$((i+1))
while [[ $j -le 4]]...
965
Posted By franksunnn
Yes! I got it.
Yes! I got it.
965
Posted By franksunnn
I got you and it works now. And if I use ((2 <...
I got you and it works now. And if I use ((2 < 10)) to check the condition of loop, that works well too. Thx!:D

---------- Post updated at 11:34 AM ---------- Previous update was at 10:43 AM...
965
Posted By franksunnn
A very weird problem about getting a random string
Hi, guys
Here is my script and it's an imaginary script to recast a string randomly.

#!/bin/bash
# scriptname: recast_string
# purpose: recast a string randomly like this "abc123" --> "21a3cb"...
7,646
Posted By franksunnn
Assuming that you have three scripts "a.sh"...
Assuming that you have three scripts "a.sh" "b.sh" "c.sh" and there are three log file "a.log" "b.log" "c.log", and here is my opinion:
Execution of b.sh depends on whether the last successful...
1,391
Posted By franksunnn
I suggest you give us some clue about input and...
I suggest you give us some clue about input and desired output.
4,592
Posted By franksunnn
diff -c file1 file2 | gawk '/^+/ {print $2}' >>...
diff -c file1 file2 | gawk '/^+/ {print $2}' >> file_diff
However, I feel it's wired. Maybe I have no idea about your real need.
908
Posted By franksunnn
My script is below: #!/bin/bash ...
My script is below:

#!/bin/bash
now_time=$(date +%Y-%m-%d\ %H:%m:%S)
echo "***Start at: $now_time***"
i=0
while [ i -lt 16 ]
do
if [ ! -e /path/to/filename ]
then
...
1,759
Posted By franksunnn
I thought it seemed kind of customary:rolleyes:
I thought it seemed kind of customary:rolleyes:
4,592
Posted By franksunnn
I have a question. e.g. Assuming that there...
I have a question.
e.g.
Assuming that there are 10 lines in the file_A and 5 lines in the file_B, and the content shown below:
file_A

file_B


please tell me what's your desired output?
1,759
Posted By franksunnn
I have one question. Let me give some example...
I have one question.
Let me give some example according to your script.
There is one file "index.html" in the directory "/home/web/aaa/bbb"
What the script does is :
1. assign "index.html" to the...
9,030
Posted By franksunnn
This is your file: and this is the script: ...
This is your file:

and this is the script:

#!/bin/bash
# scriptname: check_01
# purpose: read the file "sample" line by line and check existence of files
# and directories

while read line...
9,615
Posted By franksunnn
I don't get the exact content of svn log file. So...
I don't get the exact content of svn log file. So please let me assume that every line starting with "M" represents modification, every line starting with "A" represents adding, every line starting...
7
awk
1,809
Posted By franksunnn
cos the period punctuation "." in the double...
cos the period punctuation "." in the double quotes can represent any single character. You should use the escape sequence to get its original meaning.
like this: "\\." or /\./
2,094
Posted By franksunnn
Thanks, I got it. Your code is more efficient.
Thanks, I got it. Your code is more efficient.
1,567
Posted By franksunnn
Hi, give you a simple example, hope to help you. ...
Hi, give you a simple example, hope to help you.
Assuming there are two files named "file1", "file2" in a specified directory, shown below:
[root@centostest2 20130619]# ls -ls
total 4
0...
2,094
Posted By franksunnn
gawk...
gawk 'BEGIN{FS=OFS=","}NR==FNR{a[$1]=$2}NR>FNR{print $0,a[$2]}' file2 file1
100,A,1
200,B,2
300,C,3
600,B,2
400,C,3


---------- Post updated at 11:45 AM ---------- Previous update was at...
1,185
Posted By franksunnn
Question about awk - create a user-defined variable
Hi, guys,
The content of file is below (from <UNIX® Shells by Example Fourth Edition>):

My code is below:
gawk -F'[ :]' ' { OFS = "****"; $3 = "(904)"; $8 = $5 + $6 + $7; print } ' lab3.data...
1,253
Posted By franksunnn
Cool! Thanks!:D ---------- Post updated at...
Cool! Thanks!:D

---------- Post updated at 03:03 PM ---------- Previous update was at 03:01 PM ----------


Smart!:D
1,253
Posted By franksunnn
Question about awk format
Hi, Guys,
There is one question about AWK format. Here is the code:
gawk -F: '/^Dan/ {print "Dan's phone number is ",$2}' lab3.data

An syntax error will come out because the quote mark between...
1,067
Posted By franksunnn
I think you are right. What about my third...
I think you are right.
What about my third question?~~
1,067
Posted By franksunnn
One script and some questions
Hi, guys,
With some guys' help, I made a shellscript used to create new users(attached at the bottom).
I have some questions:
a). I need to prompt users to enter their password in my script, but...
1,061
Posted By franksunnn
OMG! I got you! Thanks
OMG!
I got you! Thanks
1,061
Posted By franksunnn
Yes, your code is simple. However, it's not good...
Yes, your code is simple. However, it's not good if the absolute path of directory contains metacharacters. So I just did my best to avoid it happened.
Showing results 1 to 25 of 46

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