LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to join this 2 script together (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-join-this-2-script-together-4175432145/)

NickPats 10-14-2012 09:55 AM

how to join this 2 script together
 
for dir in $1; do
echo $dir: $(ls "$dir" | wc -l)
done

awk '{for (i=1;i<=NF;i++){printf $i };printf "\n"}' < $2 | sort -n | tail -n1

grail 10-14-2012 11:08 AM

How are they related? I see no natural join between the 2 snippets.

Also, please use [code][/code] tags when displaying code.

NickPats 10-14-2012 11:12 AM

It first prints out the directory name and the total files that directory has.
like directory 1 has 25 files. it will print 1 : 25. i wanna use that output and find the directory with max files in it.

grail 10-14-2012 11:59 AM

So what has that got to do with the awk script? Also, it would appear this is a copy of a previous question you asked on how to find this information. Any reason why you have asked the same question again?

NickPats 10-14-2012 01:02 PM

I thought this would be easy. Sorry about that.

grail 10-14-2012 11:12 PM

It is not so much that it is difficult, but more that it is very unclear what you are trying to achieve?

I mean to combine them I could have simply said:
Code:

for dir in $1; do
echo $dir: $(ls "$dir" | wc -l)
awk '{for (i=1;i<=NF;i++){printf $i };printf "\n"}' < $2 | sort -n | tail -n1
done

But I somehow doubt this is what you are after.


All times are GMT -5. The time now is 02:28 AM.