Solved

Count how many times a word appears in a file

Posted on 2004-11-01
1,732 Views
Last Modified: 2013-12-27
I would like to know how can I count how many times a word appears in a file. The file has a unique long line.
Thanks,
Idoia
0
Question by:iaguirre
    2 Comments
     
    LVL 4

    Expert Comment

    by:Otetelisanu
    tr ' ' '\12'<filename |grep -cw word
    0
     
    LVL 4

    Accepted Solution

    by:
    Example:[


    root@pluto:/db/xx/xx] cat file
    tes tes
    dd fff
    tes tes zzz

    [root@pluto:/db/xx/xx] tr ' ' '\12'<file|grep -cw tes
    4
    [root@pluto:/db/xx/xx]
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
    FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

    913 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now