Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Word-counting and substitution with awk Post 302947968 by RudiC on Wednesday 24th of June 2015 09:13:00 AM
Old 06-24-2015
Yes, use a second (or further) gsub. I think you can use the "alternate" (= or) regex operator | . Might carry some difficulties, e.g. upper case at the begin of a sentence, or trailing punctuation. Here I did this for the German words Der, der, die, das, dem, den, des (all with optional leading capital letter):
Code:
(^[dD]|[[:space:]][dD])(ie|e[mnrs]|as)[[:punct:][:space:]]

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

word substitution in csh

I have data that looks something like this: term1/term2/2005-12-01 13:20:30/term4 I need to make it look like this: term1/term2/20051201132030/term4 I am using a csh script. I have tried to do it by first converting the date/time to the format in which I want it, and then replacing it... (1 Reply)
Discussion started by: oprestol
1 Replies

2. Linux

word substitution in unix

Hi I am trying to substitute 2 words on the same line with _S02 as suffix. Like this . IN "TSOPS09" INDEX IN "TSOPIX09" ; to IN "TSOPS09_S02" INDEX IN "TSOPIX09_S02" ; i used the following code to make the change , it works fine for first substitution not the second one . ... (6 Replies)
Discussion started by: capri_drm
6 Replies

3. Linux

Last word substitution

Ok this is last question of the day from my side . I have this file and I want to replace the last letter " , " with " ) " . The input file is #cat zip.20080604.sql CONNECT TO TST103 ; SET SESSION_USER OPSDM001 ; SET CURRENT SCHEMA OPSDM001 ; CREATE VIEW OPSDM001.vw_zip SELECT ( ... (4 Replies)
Discussion started by: capri_drm
4 Replies

4. Linux

option of grep for counting exact word ??

Hi All, I have a quary regarding grep command in linux. I have a file which contains 56677 56677 +56677 +56677 56677 56677 56677 I want to extract total count of "56677" When I hit the following command #cat filename | grep -w -c '56677' the result comes 7. Its counting... (3 Replies)
Discussion started by: maddy
3 Replies

5. Shell Programming and Scripting

whole word substitution in SED

I am trying to substitute something with sed and what I want is to substitute a whole word and not part of a word. ie sed 's/class/room/g' filename will substitute both class and classes into room and roomes which is not what i want Grep for instance can use the -w option or <> grep -w... (7 Replies)
Discussion started by: gikay01
7 Replies

6. UNIX for Dummies Questions & Answers

counting the occurence of a word

In a file I have to count a particular word. like i need apache how many times. I tried this $ tr "\011" "\012\012"<foo1 | tr -cd "" |sort\uniq -c but I got result like this 32 apache 18 dns 12 doctor Please sugest me (4 Replies)
Discussion started by: pranabrana
4 Replies

7. Homework & Coursework Questions

Counting a particular word per line

1. The problem statement, all variables and given/known data: It was the best of times, it was the worst of times, It was the age of wisdom, it was the age of foolishness, It was the epoch of belief, it was the epoch of incredulity, It was the season of Light, it was the season of Darkness, It... (3 Replies)
Discussion started by: bigubosu
3 Replies

8. Shell Programming and Scripting

Help with word substitution

Hi all, I am trying to write a script substituting one word in a particular file with another word (sed) but I'm having trouble creating the backup file. The following are my instructions: The Unix program sed is useful for making simple substitutions throughout an entire file. But one of... (0 Replies)
Discussion started by: Hoppy56
0 Replies

9. Shell Programming and Scripting

Word counting perl script

Hi friends i need a help on Perl Script In My Home directory, i have some other directories and inside those directories i have some subdirectories and all the directories contains files. Now i want to count a word in all files and i want the output like below wordcount in which file(name... (5 Replies)
Discussion started by: siva kumar
5 Replies

10. UNIX for Dummies Questions & Answers

Counting Word Appearance

How do you write a script that counts the number of times a word appears in a file and output it? Original: ID1 SMARCB1;Adil;Jon ID2 Jon;Annie;Mei ID3 Adil;Spaghetti;NBA ID4 Raptors;wethenorth;SMARCB1 ID5 SMARCB1;wethenorth Objective: SMARCB1: 3 Adil: 2 Jon: 2... (5 Replies)
Discussion started by: Lipidil
5 Replies
ISWPUNCT(3)						     Linux Programmer's Manual						       ISWPUNCT(3)

NAME
iswpunct - test for punctuation or symbolic wide character SYNOPSIS
#include <wctype.h> int iswpunct(wint_t wc); DESCRIPTION
The iswpunct() function is the wide-character equivalent of the ispunct(3) function. It tests whether wc is a wide character belonging to the wide-character class "punct". The wide-character class "punct" is a subclass of the wide-character class "graph", and therefore also a subclass of the wide-character class "print". The wide-character class "punct" is disjoint from the wide-character class "alnum" and therefore also disjoint from its subclasses "alpha", "upper", "lower", "digit", "xdigit". Being a subclass of the wide-character class "print", the wide-character class "punct" is disjoint from the wide-character class "cntrl". Being a subclass of the wide-character class "graph", the wide-character class "punct" is disjoint from the wide-character class "space" and its subclass "blank". RETURN VALUE
The iswpunct() function returns nonzero if wc is a wide-character belonging to the wide-character class "punct". Otherwise it returns zero. CONFORMING TO
C99. NOTES
The behavior of iswpunct() depends on the LC_CTYPE category of the current locale. This function's name is a misnomer when dealing with Unicode characters, because the wide-character class "punct" contains both punctuation characters and symbol (math, currency, etc.) characters. SEE ALSO
ispunct(3), iswctype(3) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
1999-07-25 ISWPUNCT(3)
All times are GMT -4. The time now is 08:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy