I have been reading posts on here for a while, but this is my first post. I have a document in which many sentences appear, and I am piping it through an exterior script which will tag each word in the document with its part of speech (not part of my script, just background). The output of this working script is vertical; that is, column 1 has the original word, column 2 has its part of speech, and column 3 is unimportant. A typical line of text becomes this when run through the part of speech tagger:
I need to find every instance that certain words appear when tagged as 'VVN', find that specific instance of that word in the original document, and delete it.
I want to search the document line by line using a series of if statements (each if statement should be evaluated on each line). I also decided to run a counter, and use that number to find the line of the original document, where I could then delete that line. Currently, though, my code is only outputting the list of words in the for loop, and I can't get it to enter the first if inside of the while loop.
My code is below:
Help is greatly appreciated - thank you all in advance!
Moderator's Comments:
Please use code tags when posting data and code samples!
Last edited by vgersh99; 04-10-2011 at 06:46 PM..
Reason: code tags, please!
Here is a basic script to search a given directory for a key word. To execute it if it was saves with the file name of test then it would be executed by typing ./test (directory path) (keyword)
of course this is after the permissions was edited by chmod 755 (filename)
Last edited by Scott; 04-10-2011 at 08:16 PM..
Reason: Please use code tags
Hi everybody,
I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o
My code:
#!/bin/sh
set -e
set -u
export IFS=
optl="Optl"
LOCSTORCLI="/opt/lsi/storcli/storcli"
($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
I'm taking a unix class and need to countdown to 0 from whatever number the user inputs. I know how to do this with a while or until loop but using the for loop is throwing me off....
I know I can use an if-then statement in my for loop but can I include a while loop in my for loop? (3 Replies)
Hi All,
Below is the very simple code snippet but it si giving me syntax error
#!/bin/bash
#To ensure If JMS directory exists or not
ServerName=$(hostname)
#To ensure If JMS directory exists or not
echo $ServerName
if ;
then
echo "Inside First If"
if ;
then
echo 'JMS... (4 Replies)
Hello,
I'm trying to write (my own primitive) traceroute command that would write out all IPs that packets are hoping through. :)
So I've put the ping command inside a for loop
#!/bin/bash
domain=${1-www.google.com}; #If no argument, then do www.google.com.
for ((i=1; i<=30; i++)) #... (9 Replies)
Hi all
Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Hi,
I am using su within a for loop. As you might expect, it prompts for password during each loop execution. Here is my piece of code:
for i in $LIST
do
if
then
DATABASE=`echo $i | awk -F "|" '{ print $1 }'`
USER_ID=`echo $i | awk -F "|" '{ print $2 }'`
su - apstage -c... (1 Reply)
Hi,
im having problem creating a loop using my code: aside from the fact that the 1st variable (VAR) does not increment, it loops more than the expected output.
for sample purposes, test csv contains 3 lines.
#get number of lines in the file
lines=$( wc -l < test.csv )
... (5 Replies)
I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends.
As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Hi Gurus
I have a file called /tmp/CMDB which looks like this
serial: 0623AN1208
hostname: server1
model: x4100
assetID: 1234
I am writing a for loop that will go through this file line by line creating a variable of itself. Using the first iteration of the loop (i.e. the first line) as... (6 Replies)
Hi I am trying read in side a do statement
but it is not working it is just printing abc before read but not stopping in abc for user input
Can anybody please help
#!/usr/bin/ksh
cat sample_file | while read ln_source3
do
param=`echo $ln_source3 | nawk... (1 Reply)