sed script help urgent


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting sed script help urgent
# 1  
Old 06-28-2007
sed script help urgent

Collegues
I am dealing with raw text files which is extracted from web pages.
I have to find sentances which contains more than 99 words and have to put a "." after the 99th or 98 th word .
Is there any possiblity to it in sed or awk
With regards
Jaganadh.H
# 2  
Old 06-28-2007
Jaganadh,
Please, give us a sample of your file.
# 3  
Old 06-28-2007
A first approach:
Code:
awk '
   BEGIN { RS = ORS = "." }
   { for (f=99; f<NF; f=f+99) $f=$f ORS ;print $0 }
' inputfile

# 4  
Old 06-28-2007
Quote:
Originally Posted by Shell_Life
Jaganadh,
Please, give us a sample of your file.
The following is example sentance.
How ever the sentance may not be a meaning ful one.
The Six Ritus The six ritus and their properties can be summarized in the following table Kaal Ritu Maas Properties of the season Aadaan Solastice Sishira Magha and Phalguna January to mid march Cold and dewy season Vasanta Chaitra and Baisakh March to mid May Spring season Grishma Jyeshtha and Aashadha May to mid July Summer season Visarga Solastice Varsha Shravan and Bhadrapada July to mid September Rainy season Sharat Aashvin and Kartika September to mid November Autumn season Hemant Margshirsha and Pausha November to mid January Winter season Seasons and Tastes The following table summarizes the tastes which are more powerful and hence can be included in the diet in each of the six seasons .
# 5  
Old 06-29-2007
Thanks

Collegues
Thanks a lot for providing an effective solution for my querry.
I am using the charniak parser for some research. It does not take sentance longer than 100 words. Just I want to over ride the problem by a script. The script is working fine.

Jaganadh.G
Linguist
# 6  
Old 06-29-2007
Code:
awk -F" " '{ $98 = $98" ."; print }' filename

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

URGENT Reading a file and assessing the syntax shell script URGENT

I am trying to write a shell script which takes an input file as an arguement in the terminal e.g. bash shellscriptname.sh input.txt. I would like for the file to be read line by line each time checking if the .txt file contains certain words or letters(validating the syntax). If the line being... (1 Reply)
Discussion started by: Gurdza32
1 Replies

2. Shell Programming and Scripting

sed command error-URGENT

sort.sh ------ ls -lSr|cat -n/*gives the detailed description o files with a serial number concatenated*/ i=0 n=10 j=$n if then while do (sh -C sub.sh $i $j)& ((i++)) ((j--)) done fi if then while do (sh -C sub.sh $i $j)& (1 Reply)
Discussion started by: dishak
1 Replies

3. Shell Programming and Scripting

Need Urgent help on awk/sed

Hi, Sample Input Table 1 XXXXX YYYYY A 1 2 3 4 5 B 1 2 3 4 5 C 1 2 3 4 5 D 1 2 3 4 5 A 6 7 B 6 7 C 6 7 D 6 7 Table 2 XXXXX YYYYY E 1 2 3 4 5 F 1 2 3 4 5 E 6 7 F 6 7 Table 3 XXXXX YYYYY G 1 2 3 4 5 (4 Replies)
Discussion started by: ravin
4 Replies

4. Shell Programming and Scripting

Urgent help req with grep + sed

HI all, i have a line in a file it cantains one;two_1_10;two_2_10;two_3_10;three~ now i need to get the output as one;two_1_abc_10;two_2_abc_10;two_3_abc_10;three~ ( 1 should be replaced with 1_abc for two__10 , and one more thing the number of occurances of two_value_10 will be... (1 Reply)
Discussion started by: 2001.arun
1 Replies

5. Shell Programming and Scripting

awk or sed help urgent

Hello, I have a file with the follwoing pattern: Input file: =========== tcp://xxx:123 8179 YY 1798 YY tcp://abc:2345 not found tcp://swt:4945 7356 QQ tcp://pqr:456 8178 PP 9485 PP 4485 PP (8 Replies)
Discussion started by: uandme2k2
8 Replies

6. Infrastructure Monitoring

sed help,,kind of urgent!!

Hello All, My problem is: I want to replace a line from a file with sed. The first word in that line is always the same in every server. The second line is server model, which of course will vary from platform to platform and I need to leave that word as it is. After the second word, I need to... (3 Replies)
Discussion started by: solaix14
3 Replies

7. Shell Programming and Scripting

Need Help using sed command(very urgent)

Hi all, Actually i want to delete the .ps extension from package1.ps string by using sed. Can any body tell me that how shell i do it????????? It is very urgent. Can anybody help me. I am trying to do this in the following way. ps_file="package1.ps" echo $ps_file sed s/.ps//g $ps_file... (9 Replies)
Discussion started by: sunitachoudhury
9 Replies

8. Shell Programming and Scripting

Urgent Help With Sed

Hello, I need to use sed to replace a word in file. My command is this: sed "s/word_to_replace/'"${INPUT}"'/1 filename and because INPUT="~@#$%^&*()-_=+{}\|;:<>,./?" and / is also the delimiter so I'm keep on getting error message sed: command garbled: ... any suggestions about how I... (10 Replies)
Discussion started by: katrvu
10 Replies

9. Shell Programming and Scripting

Need urgent sed help

I am writing a shell script on SunOS cosuaah01 5.9 Generic_118558-11 sun4u sparc SUNW,Sun-Fire-V440 machine. The shell script in.sh looks like this: install_top=`pwd` fl2=/d01/applptch/ptchora/iAS/Apache/Apache/cgi-bin/cxtool/display_report.pl echo $fl2 mv $fl2 $fl2.old sed 5c\... (6 Replies)
Discussion started by: bhatia333
6 Replies

10. UNIX for Dummies Questions & Answers

urgent sed help

Hi folks. I've tried to research this, but haven't found a good answer (could be my harried state). At any rate, I have records that end with two commas, a number, two commas this could be anywhere from ,,01,, to ,,09875953,, I need to remove the last two fields (the number... (3 Replies)
Discussion started by: kristy
3 Replies
Login or Register to Ask a Question