what does this script do ?
I can break down this script in few pieces, but could not figure it out what is the purpose of this script ? Would someone please help me ? Maybe this script was a not good way to write a script ?
cat $1 | tr-sc "[A-Z]" "[a-z]" "[|012*]" |sort | uniq -c | sort -n | tail I saved this script and run through a few text file, below are the results I got: [root@QuickMPEP bin]# scriptA file1.txt 13 in 14 We 15 a 18 free 18 software 24 to 25 of 26 and 31 Fedora 31 the [root@QuickMPEP bin]# scriptA file1.txt 13 in 14 We 15 a 18 free 18 software 24 to 25 of 26 and 31 Fedora 31 the [root@QuickMPEP bin]# scriptA fileoutput 9 is 9 open 9 our 9 source 11 of 15 to 25 Hat 25 Red 27 the 31 and [root@QuickMPEP bin]# scriptA redhat 20 for 20 on 29 cloud 32 Cloud 42 of 44 to 63 the 85 Red 86 Hat 88 and |
Look up each command you don't understand until you have covered the whole thing.
|
I did, however, it does not make sense once you put them together :(
|
What script? I just see a command.
|
I saved this command to a exe file called scriptA, then run scriptA through a few text files to test the result. thanks, Jun
|
Quote:
You will need to explain further exactly which part of this command line example is confusing? I would add, when displaying code / data please use [code][/code] tags so it is more readable. |
I don't know about Linux at all, and I am learning now, I looked up the commends and took a guess:
cat $1 | tr-sc "[A-Z]" "[a-z]" "[|012*]" |sort | uniq -c | sort -n | tail The first part code: Code:
tr - sc "[A-Z]" "[a-z]" "[\012*]" |
Quote:
When in doubt about any section, just rip it out and use it on a single / few lines and see what happens |
Code:
sort | uniq -c| Code:
sort -n Code:
tail not sure how to put together what this commend does : translate all the upper case to lowercase from the text file, and sort it according to the the string numerical value and start a new line , output the number of the occurrences ? thanks, Jun |
Well I do find it interesting as the tr command errors for me, but as long as you got it to work :)
|
All times are GMT -5. The time now is 05:06 PM. |