Shell script to find longest phrase


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Shell script to find longest phrase
# 8  
Old 02-24-2009
hahaha .. I know exactly what you mean Kevin .. Smilie .. I wish I had a choice too :P .. But I need this as added functionality to the search engine I am designing ..

Read my post above, the for loop idea that I have .. Do u think it is feasible ?? or even possible ?

Neha
# 9  
Old 02-24-2009
I doubt a loop is the way to go, especially if this is a general utility search engine. It could probably work if the data is very limited in length.
# 10  
Old 02-24-2009
Yes. I agree. which is why i am asking here if anyone can think of a more feasible way .. Smilie

The search is limited to news articles though .. So this script that i am designing will run only on text that is anywhere between 100 and 1000 words in length.
# 11  
Old 02-25-2009
This is worth moving to the advanced section.
# 12  
Old 02-25-2009
Umm .. where would that be ?? I just posted under shell scripts .. Didnt know there was an advanced section.
# 13  
Old 02-25-2009
Quote:
Originally Posted by stargazerr
A phrase is a collection of n number of words that are the same. Could be anything from 2 to n.
That I know (I ask my friend Google Smilie ) however to solve the problem I have to options :
1. Ask you to post a data sample.
2. Build my own data sample (for you)... see previous post Smilie
# 14  
Old 02-25-2009
lol .. okk danmero .. Here is one of the text files I am working from, as an example. Smilie .. After removal of HTML tags and extraction of only the content i require, i.e, title, author, date and article content. This data will eventually be pulled from a database. But right now .. i am working from text files. Smilie

In Tough Times, the Humanities Must Justify Their Worth
Katie Orlinsky for The New York Times

Published: February 24, 2009

One idea that elite universities like Yale, sprawling public systems like Wisconsin and smaller private colleges like Lewis and Clark have shared for generations is that a traditional liberal arts education is, by definition, not intended to prepare students for a specific vocation. Rather, the critical thinking, civic and historical knowledge and ethical reasoning that the humanities develop have a different purpose: They are prerequisites for personal growth and participation in a free democracy, regardless of career choice.

But in this new era of lengthening unemployment lines and shrinking university endowments, questions about the importance of the humanities in a complex and technologically demanding world have taken on new urgency. Previous economic downturns have often led to decreased enrollment in the disciplines loosely grouped under the term “humanities” - which generally include languages, literature, the arts, history, cultural studies, philosophy and religion. Many in the field worry that in this current crisis those areas will be hit hardest.

Already scholars point to troubling signs. A December survey of 200 higher education institutions by The Chronicle of Higher Education and Moody's Investors Services found that 5 percent have imposed a total hiring freeze, and an additional 43 percent have imposed a partial freeze.

In the last three months at least two dozen colleges have canceled or postponed faculty searches in religion and philosophy, according to a job postings page on Wikihost.org. The Modern Language Association's end-of-the-year job listings in English, literature and foreign languages dropped 21 percent for 2008-09 from the previous year, the biggest decline in 34 years.

“Although people in humanities have always lamented the state of the field, they have never felt quite as much of a panic that their field is becoming irrelevant,” said Andrew Delbanco, the director of American studies at Columbia University.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help script shell find fichier

Hello, I am looking for a shell script that can 1- take as input a variable, like "server.cpu" 2- do a search for that variable in a directory that contains subdirectories. The search will start at the last subdirectory working up to the top level if I can not find the file 3-... (7 Replies)
Discussion started by: georg2014
7 Replies

2. Shell Programming and Scripting

How to find a phrase and pull all lines that follow until the phrase occurs again?

I want to burst a report by using the page number value in the report header. Each section starts with *PAGE NO:* 1 Each section might have several pages, but the next section always starts back at 1. So I want to find the "*PAGE NO:* 1" value and pull all lines that follow until "*PAGE NO:* 1"... (4 Replies)
Discussion started by: Scottie1954
4 Replies

3. Shell Programming and Scripting

Shell script to find the sum of argument passed to the script

I want to make a script which takes the number of argument, add those argument and gives output to the user, but I am not getting through... Script that i am using is below : #!/bin/bash sum=0 for i in $@ do sum=$sum+$1 echo $sum shift done I am executing the script as... (3 Replies)
Discussion started by: mukulverma2408
3 Replies

4. Shell Programming and Scripting

How to find out the shell of the shell script?

Hello My question is: How to find out the shell of the shell script which we are running? I am writing a script, say f1.sh, as below: #!/bin/ksh echo "Sample script" From the first line, we can say this script will run in ksh. But, how can we prove it? Can we print anything inside... (6 Replies)
Discussion started by: guruprasadpr
6 Replies

5. Shell Programming and Scripting

Find longest string and print it

Hello all, I need to find the longest string in a select field and print that field. I have tried a few different methods and I always end up one step from where I need to be. Methods thus far: nawk '{if (length($1) > long) long=length($1); if(length($1)==long) print $1}' The above... (6 Replies)
Discussion started by: SEinT
6 Replies

6. Shell Programming and Scripting

Bash script find longest line/lines in several files

Hello everyone... I need to find out, how to find longest line or possibly lines in several files which are arguments for script. The thing is, that I tried some possibilities before, but nothing worked correctly. Example when i use: awk ' { if ( length > L ) { L=length ;s=$0 } }END{ print... (23 Replies)
Discussion started by: 1tempus1
23 Replies

7. Shell Programming and Scripting

shell script: longest match from right?

Return the position of matched string from right, awk match can do from left only. e.g return pos 7 for search string "service" from "AA-service" or return the matched string "service", then caculate the string length. Thanks!. (3 Replies)
Discussion started by: honglus
3 Replies

8. Shell Programming and Scripting

find PHRASE and PATH

I've got a script which finds *.txt files in directories and subdirectories after providing the path by the user and then searches in the files for phrase given by the user How to write script in such way that the paths to the found *.txt files and the phrase given by the user were both... (2 Replies)
Discussion started by: patrykxes
2 Replies

9. Shell Programming and Scripting

c shell script help with find

Okie here is my problem, 1. I have a directory with a ton of files. 2. I want to first get an input on how many days ago the files were created. 3. I will take those files and put it into another file 4. Then I will take the last # from each line and subtract by 1 then diff the line from the... (1 Reply)
Discussion started by: bigboizvince
1 Replies

10. Shell Programming and Scripting

Find the length of the longest line

Dear All, To find the length of the longest line from a file i have used wc -L which is giving the proper output... But the problem is AIX os does not support wc -L command. so is there any other way 2 to find out the length of the longest line using awk or sed ? Regards, Pankaj (1 Reply)
Discussion started by: panknil
1 Replies
Login or Register to Ask a Question