Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Problems with deleting punctuation and apostrophes Post 302656779 by Corona688 on Friday 15th of June 2012 11:24:51 AM
Old 06-15-2012
useless use of cat

Code:
awk 'NR==FNR { STOP[$1]++; next }

{
        gsub(/[^a-zA-Z \t]/, ""); # Replace non-whitespace with nothing.
        $0=tolower($0); # Lowercase and separate the string
        for(N=1; N<=NF; N++) if(!($N in STOP)) W[$1]++ # Count all non-stopwords
}

END { for(X in W) print W[X], X; } # Print count of words' stopwords.txt words.txt

Use nawk on solaris.
This User Gave Thanks to Corona688 For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

whacky punctuation dealies

Say I have a command that looks like this: host=$(/usr/bin/host xxx.xxx.xxx.xxx) What is the significance of the $() I know what happens when I don't include them, and I know what happens when I do, but... Why doo it woik wit $() Sorry for the lame question :o (3 Replies)
Discussion started by: [MA]Flying_Meat
3 Replies

2. Shell Programming and Scripting

How to include a variable between apostrophes within a command

Hi. I'm trying to find some words within my directory and created a text file containing them which is read by my shell script: #!/bin/bash var=`cat words.txt` for i in $var; do echo $i find -type f -print0 | xargs -r0 grep -F '$i' done But it searches "$i" (dollar sign... (2 Replies)
Discussion started by: guarriman
2 Replies

3. What is on Your Mind?

Names/nicknames for certain punctuation

I know that forward slash and backslash are "whack" and "backwhack," and I know that a pound-sign or number sign is "crunch" and an exclamation point, "bang." What I would like to know is whether or not there's a popular nickname for the dollar sign. I call it "cash," but that may just be Yank... (6 Replies)
Discussion started by: SilversleevesX
6 Replies

4. Programming

Regex to pull out all words in apostrophes in a string

Hi, I have string like this: CHECK (VALUE::text = ANY (ARRAY)) and I am trying to get out the words in apostrophes ('). In this case"ACTIVE INACTIVE DELETE" Also the array may consist of one or more words (in given example 3). Also instead of word it can be only one LETTER. And... (4 Replies)
Discussion started by: neptun79
4 Replies

5. Shell Programming and Scripting

grep ignoring punctuation

I have a file xxx.txt containing winter_kool sugar_"sweet" Is there anyway i can grep xxx.txt for strings without using punctuations. for eg: `grep sugarsweet xxx.txt` should give output : sugar_"sweet" (2 Replies)
Discussion started by: jack_gb
2 Replies

6. Shell Programming and Scripting

Replacing punctuation marks with the help of sed

#!/bin/bash a=(*.pdf) punct=((~`!@#$%^&*()_-+=|\{};':",./<>?)) for (( i =0; i < ${#a}; i++ )) do sed -ri 's/$punct//g' ${a} done I cannot use the above code, can you help me in removing all punctuation marks from file name except file extension. The idea is that once all... (9 Replies)
Discussion started by: ambijat
9 Replies

7. Shell Programming and Scripting

PHP Labeling/Punctuation Syntax Question

Greetings! My first PHP question; and, no doubt, a "no-brainer" for the initiated :) The question centers around the proper syntax for input field labeling. The snippet which puzzles me (and the candidate which I wish to modify) goes like this:<?php _e('Hello World'); ?>:<br />What I'd like... (0 Replies)
Discussion started by: LinQ
0 Replies

8. Shell Programming and Scripting

Printing apostrophes by using awk

Hello All, I would like to ask your kind help regarding the following query: I have this line: awk '$2>5 {print "File: "$1,$2}' I have got this output: File: zzzds 76 File: fd9ffh 58 File: gfh0dg 107 .... Could you please help me how to modify my line to get these outputs with... (5 Replies)
Discussion started by: Padavan
5 Replies

9. HP-UX

Problems after deleting /var/tmp

Hi, To clear up the filesystem, I archived /var/tmp (forgot that this directory was important for crontab), and then deleted the directory itself. After that there were problems like crontab not accessible, certain ftp commands like mget not functioning, and worst there were some scripts which... (4 Replies)
Discussion started by: anaigini45
4 Replies

10. Shell Programming and Scripting

Adding text from a variable using sed (Or awk) with punctuation

Hi All, I would have though this would have been simple, but... I have text in a variable that I need to insert into a bunch of other files... The text is simple: ... (2 Replies)
Discussion started by: joeg1484
2 Replies
URI::URL(3)						User Contributed Perl Documentation					       URI::URL(3)

NAME
URI::URL - Uniform Resource Locators SYNOPSIS
$u1 = URI::URL->new($str, $base); $u2 = $u1->abs; DESCRIPTION
This module is provided for backwards compatibility with modules that depend on the interface provided by the "URI::URL" class that used to be distributed with the libwww-perl library. The following differences exist compared to the "URI" class interface: o The URI::URL module exports the url() function as an alternate constructor interface. o The constructor takes an optional $base argument. The "URI::URL" class is a subclass of "URI::WithBase". o The URI::URL->newlocal class method is the same as URI::file->new_abs. o URI::URL::strict(1) o $url->print_on method o $url->crack method o $url->full_path: same as ($uri->abs_path || "/") o $url->netloc: same as $uri->authority o $url->epath, $url->equery: same as $uri->path, $uri->query o $url->path and $url->query pass unescaped strings. o $url->path_components: same as $uri->path_segments (if you don't consider path segment parameters) o $url->params and $url->eparams methods o $url->base method. See URI::WithBase. o $url->abs and $url->rel have an optional $base argument. See URI::WithBase. o $url->frag: same as $uri->fragment o $url->keywords: same as $uri->query_keywords o $url->localpath and friends map to $uri->file. o $url->address and $url->encoded822addr: same as $uri->to for mailto URI o $url->groupart method for news URI o $url->article: same as $uri->message SEE ALSO
URI, URI::WithBase COPYRIGHT
Copyright 1998-2000 Gisle Aas. perl v5.12.1 2008-04-04 URI::URL(3)
All times are GMT -4. The time now is 11:48 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy