Sponsored Content
Top Forums Shell Programming and Scripting Word Occurrences script using awk Post 302923183 by ksmarine1980 on Friday 31st of October 2014 12:24:19 AM
Old 10-31-2014
Thank you, Chubler! Any idea how I can print off the index value as well? Should I be using asorti instead of sort? I'd like my output to appear like the following example:

Index Word Count
1 the 247
2 a 215
3 to 201
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count the number of occurrences of the word

I am a newbie in UNIX shell script and seeking help on this UNIX function. Please give me a hand. Thanks. I have a large file. Named as 'MyFile'. It was tab-delmited. I am told to write a shell function that counts the number of occurrences of the ord “mysring” in the file 'MyFile'. (1 Reply)
Discussion started by: duke0001
1 Replies

2. Shell Programming and Scripting

awk and gsub - how to replace only the first X occurrences

I have a text (text.txt) and I would like to replace only the first 2 occurrences of a word (but I might need to replace more): For example, if text is this: CAR sweet head hat red yellow CAR book brown tiger CAR cow CAR CAR milk I would like to replace the word "CAR" with word... (12 Replies)
Discussion started by: bingel
12 Replies

3. Homework & Coursework Questions

Du without directory and Grep for occurrences of a word

Assistance on work Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Files stored in ... (1 Reply)
Discussion started by: alindner
1 Replies

4. Shell Programming and Scripting

Count occurrences in awk

Hello, I have an output from GDB with many entries that looks like this 0x00007ffff7dece94 39 in dl-fini.c 0x00007ffff7dece97 39 in dl-fini.c 0x00007ffff7ab356c 50 in exit.c 0x00007ffff7aed9db in _IO_cleanup () at genops.c:1022 115 in dl-fini.c 0x00007ffff7decf7b in _dl_sort_fini (l=0x0,... (6 Replies)
Discussion started by: ikke008
6 Replies

5. Shell Programming and Scripting

Script to count word occurrences, but exclude some?

I am trying to count the occurrences of ALL words in a file. However, I want to exclude certain words: short words (i.e. <3 chars), and words contained in an blacklist file. There is also a desire to count words that are capitalized (e.g. proper names). I am not 100% sure where the line on... (5 Replies)
Discussion started by: Cronk
5 Replies

6. UNIX for Dummies Questions & Answers

BASH - Counting word occurrences in a Web Page

Hi all, I have to do a script bash (for university) that counts all word occurrences in a specific web page. anyone can help me?. Thanks :) (1 Reply)
Discussion started by: piacentero
1 Replies

7. UNIX for Dummies Questions & Answers

Awk: Counting occurrences between two files

Hi, I have two text files (1.txt and 2.txt). 2.txt contains two columns which are extracted from 1.txt using a simple if(condition) print. I want to: - count how many times the values contained in 2.txt appear in 1.txt -if they appear just one time, I have to delete the entire row in... (5 Replies)
Discussion started by: Pintug
5 Replies

8. Shell Programming and Scripting

awk Group By and count string occurrences

Hi Gurus, I'm scratching my head over and over and couldn't find the the right way to compose this AWK properly - PLEASE HELP :confused: Input: c,d,e,CLICK a,b,c,CLICK a,b,c,CONV c,d,e,CLICK a,b,c,CLICK a,b,c,CLICK a,b,c,CONV b,c,d,CLICK c,d,e,CLICK c,d,e,CLICK b,c,d,CONV... (6 Replies)
Discussion started by: Royi
6 Replies

9. UNIX for Advanced & Expert Users

Find 2 occurrences of a word and print file names

I was thinking something like this but it always gets rid of the file location. grep -roh base. | wc -l find . -type f -exec grep -o base {} \; | wc -l Would this be a job for awk? Would I need to store the file locations in an array? (3 Replies)
Discussion started by: cokedude
3 Replies

10. UNIX for Beginners Questions & Answers

awk or sed script to count number of occurrences and creating an average

Hi Friends , I am having one problem as stated file . Having an input CSV file as shown in the code U_TOP_LOGIC/U_HPB2/U_HBRIDGE2/i_core/i_paddr_reg_2_/Q,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0... (4 Replies)
Discussion started by: kshitij
4 Replies
iconv_dhn(5)						Standards, Environments, and Macros					      iconv_dhn(5)

NAME
iconv_dhn - code set conversion tables for DHN (Dom Handlowy Nauki) DESCRIPTION
The following code set conversions are supported: +--------------------------------------------------------------------+ | Code Set Conversions Supported | +--------------+--------+--------------+--------+--------------------+ | Code |Symbol |Target Code |Symbol | Target Output | +--------------+--------+--------------+--------+--------------------+ |DHN |dhn |ISO 8859-2 |iso2 | ISO Latin 2 | +--------------+--------+--------------+--------+--------------------+ |DHN |dhn |MS 1250 |win2 | Windows Latin 2 | +--------------+--------+--------------+--------+--------------------+ |DHN |dhn |MS 852 |dos2 | MS-DOS Latin 2 | +--------------+--------+--------------+--------+--------------------+ |DHN |dhn |Mazovia |maz | Mazovia | +--------------+--------+--------------+--------+--------------------+ CONVERSIONS
The conversions are performed according to the following tables. All values in the tables are given in octal. DHN to ISO 8859-2 For the conversion of DHN to ISO 8859-2, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | DHN | ISO 8859-2 | DHN | ISO 8859-2 | |24-177 | 40 |222 |40 | |200 | 241 |223 |364 | |201 | 306 |224 |366 | |202 | 312 |225-230 |40 | |203 | 243 |231 |326 | |204 | 321 |232 |334 | |205 | 323 |233-237 |40 | |206 | 246 |240 |341 | |207 | 254 |241 |355 | |210 | 257 |242 |363 | |211 | 261 |243 |372 | |212 | 346 |244-340 |40 | |213 | 352 |341 |337 | |214 | 263 |342-365 |40 | |215 | 361 |366 |367 | |216 | 363 |367 |40 | |217 | 266 |370 |260 | |220 | 274 |371-376 |40 | |221 | 277 | | | +---------------+----------------+----------------+---------------+ DHN to MS 1250 For the conversion of DHN to MS 1250, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | DHN | MS 1250 | DHN | MS 1250 | |200 | 245 |233-237 |40 | |201 | 306 |240 |341 | |202 | 312 |241 |355 | |203 | 243 |242 |363 | |204 | 321 |243 |372 | |205 | 323 |244-251 |40 | |206 | 214 |252 |254 | |207 | 217 |253-255 |40 | |210 | 257 |256 |253 | |211 | 271 |257 |273 | |212 | 346 |260-340 |40 | |213 | 352 |341 |337 | |214 | 263 |342-345 |40 | |215 | 361 |346 |265 | |216 | 363 |347-360 |40 | |217 | 234 |361 |261 | |220 | 237 |362-365 |40 | |221 | 277 |366 |367 | |222 | 40 |367 |40 | |223 | 364 |370 |260 | |224 | 366 |371 |40 | |225-230 | 40 |372 |267 | |231 | 326 |373-376 |40 | |232 | 334 | | | +---------------+----------------+----------------+---------------+ DHN to MS 852 For the conversion of DHN to MS 852, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | DHN | MS 852 | DHN | MS 852 | |200 | 244 |212 |206 | |201 | 217 |213 |251 | |202 | 250 |214 |210 | |203 | 235 |215 |344 | |204 | 343 |216 |242 | |205 | 340 |217 |230 | |206 | 227 |220 |253 | |207 | 215 |221 |276 | |210 | 275 |222-375 |40 | |211 | 245 | | | +---------------+----------------+----------------+---------------+ DHN to Mazovia For the conversion of DHN to Mazovia, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | DHN | Mazovia | DHN | Mazovia | |200 | 217 |212 |215 | |201 | 225 |213 |221 | |202 | 220 |214 |222 | |203 | 234 |215 |244 | |204 | 245 |216 |242 | |205 | 243 |217 |236 | |206 | 230 |220 |246 | |207 | 240 |221 |247 | |210 | 241 |222-247 |40 | |211 | 206 | | | +---------------+----------------+----------------+---------------+ FILES
/usr/lib/iconv/*.so conversion modules /usr/lib/iconv/*.t conversion tables /usr/lib/iconv/iconv_data list of conversions supported by conversion tables SEE ALSO
iconv(1), iconv(3C), iconv(5) SunOS 5.10 18 Apr 1997 iconv_dhn(5)
All times are GMT -4. The time now is 02:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy