Sponsored Content
Full Discussion: Help with wordcount
Top Forums Shell Programming and Scripting Help with wordcount Post 302555728 by legolad on Thursday 15th of September 2011 11:35:26 AM
Old 09-15-2011
Help with wordcount

Hi, this is my first post so bare with me


I have a file which I want to count the amounts of the same line in the file and display by using a shell script

for example

file1
Code:
apple
apple
apple.
bananas

i would like the output to be
Code:
apple 2
apple. 1
bananas 1

however, i need this script to be flexible as it will not always be counting the same things
is this possible?

Thanks for any help you can give

Last edited by radoulov; 09-15-2011 at 12:36 PM.. Reason: Code tags!
 

2 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

test wordcount

Hello I want to run this test: If wordcount of a command is 0 then echo XXXX else echo YYYYY if ; then echo "all devices are created on RAID10"; else echo "Some devices are created on non-RAID10"; fi I receive this message -bash: command substitution: line 1: syntax error near... (3 Replies)
Discussion started by: melanie_pfefer
3 Replies

2. UNIX for Dummies Questions & Answers

Math with wordcount output

Hi I know very little about unix. I have a unix code (which I'm running in geektools) which gives me the word count of a pages document. However, the pages document innately contains 522 words of superfluous "Ipsem Lorem..." text which are included in the count. How would I go about... (4 Replies)
Discussion started by: eunoia7
4 Replies
platform::shell(n)					       Tcl Bundled Packages						platform::shell(n)

__________________________________________________________________________________________________________________________________________________

NAME
platform::shell - System identification support code and utilities SYNOPSIS
package require platform::shell ?1.1.4? platform::shell::generic shell platform::shell::identify shell platform::shell::platform shell _________________________________________________________________ DESCRIPTION
The platform::shell package provides several utility commands useful for the identification of the architecture of a specific Tcl shell. This package allows the identification of the architecture of a specific Tcl shell different from the shell running the package. The only requirement is that the other shell (identified by its path), is actually executable on the current machine. While for most platform this means that the architecture of the interrogated shell is identical to the architecture of the running shell this is not generally true. A counter example are all platforms which have 32 and 64 bit variants and where a 64bit system is able to run 32bit code. For these running and interrogated shell may have different 32/64 bit settings and thus different identifiers. For applications like a code repository it is important to identify the architecture of the shell which will actually run the installed packages, versus the architecture of the shell running the repository software. COMMANDS
platform::shell::identify shell This command does the same identification as platform::identify, for the specified Tcl shell, in contrast to the running shell. platform::shell::generic shell This command does the same identification as platform::generic, for the specified Tcl shell, in contrast to the running shell. platform::shell::platform shell This command returns the contents of tcl_platform(platform) for the specified Tcl shell. KEYWORDS
operating system, cpu architecture, platform, architecture platform::shell 1.1.4 platform::shell(n)
All times are GMT -4. The time now is 03:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy