#!/usr/bin/env sh
# @(#) s1 Demonstrate delete lines of range exclusive.
# This solution based on code tutorial at:
# http://sed.sourceforge.net/sedfaq.html
# 2007.12.25
set -o nounset
echo
debug=":"
debug="echo"
## Use local command version for the commands in this demonstration.
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version bash sed
echo
FILE=${1-data1}
echo " Input file $FILE:"
cat $FILE
echo
echo " Results from sed:"
sed '/WISH_LIST="/,/^"$/{
/WISH_LIST="/b
/^"$/b
d
}' $FILE
exit 0
Producing:
Code:
% ./s1
(Versions displayed with local utility "version")
GNU bash 2.05b.0
GNU sed version 4.1.2
Input file data1:
hello
start
WISH_LIST="
candy
money
t-shirt
"
stop
cool
Christmas
Results from sed:
hello
start
WISH_LIST="
"
stop
cool
Christmas
Could someone please help me with the following.
I'm trying to figure out how to delete two words within a specific file using sed.
The two words are directory and named.
I have tried the following:
sed '//d' sedfile
sed '//d' sedfile
both of these options do not work.....
... (4 Replies)
Hi,
Could you please let me know, how to delete first 10 words from text files using vi?
10dw will delete it from current line, how to do it for all the lines from file?
Thanks (6 Replies)
I have an input text that looks like this (comes already sorted):
on Caturday 22 at 10:15, some event
on Caturday 22 at 10:15, some other event
on Caturday 22 at 21:30, even more events
on Funday 23 at 11:00, yet another event
I need to delete all the matching words between the lines, from... (2 Replies)
I'm hoping someone could help me out please :)
I have several .txt files with several hundred lines in each that look like this:
10241;</td><td>10241</td><td class="b">x2801;</td><td>2801</td><td>TEXT-1</td></tr>
10242;</td><td>10242</td><td... (4 Replies)
Hi,
I wanted to delete data between two words.
Input:
I read gihoihsahkjlk write goal hard read hsakdjhkh write work read hlkhlkhlkh write
Desired Output:
I write goal hard write work write
We have to replace the data that comes between 'read' and 'write' with... (3 Replies)
This is a Nagios situation.
So i have a list of servers in one file called Servers.txt
And in another file called hostgroups.cfg, i want to remove each and every one of the servers in the Servers.txt file.
The problem is, the script I wrote is having a problem removing the exact servers in... (5 Replies)
Hi all,
I want to make an script using sed that removes everything between 'begin' (including the line that has it) and 'end1' or 'end2', not removing this line.
Let me paste an 2 examples:
anything before
any string begin
few lines of content
end1
anything after
anything before
any... (4 Replies)
I have a word file that looks like:
pens
binder
spiral
user
I want to delete all the words without the letter /s/, so output looks like:
pens
spiral
user
I tried using sed:
sed '//d' infile.txt > out.txt (5 Replies)
hi, i have a fasta file like this:
>contig00003 length=363 numreads=45 gene=isogroup00001 status=it_thresh
GATTTTTTACCCTGGGAGTGAGGAGGACGAGGTTGAGGATGAAGAAAAGAGAAAGATGAAGAGGTTGAGGATGTT
GTAGTCGGCGGTGGAATTAGGGGGAGCCGGCGAGCCCAAGTATTTTGCAGAGGTGTCTTCATCATCCAAACAACA... (3 Replies)
spell(1) General Commands Manual spell(1)NAME
spell, hashmake, spellin, hashcheck - find spelling errors
SYNOPSIS
local_file] [files]
n
spelling_list
DESCRIPTION
The command collects words from the named files and looks them up in a spelling list. Words that neither occur among nor are derivable (by
applying certain inflections, prefixes, and/or suffixes) from words in the spelling list are printed on the standard output. If no files
are named, words are collected from the standard input.
The command ignores most and eqn constructions.
Options
The command recognizes the following options:
All words not literally in the spelling list are printed,
and plausible derivations from the words in the spelling list are indicated.
British spelling is checked.
Besides preferring etc., this option insists upon in certain words, such as in
Every plausible stem is printed with
for each word.
By default, follows chains of included files much like (see deroff(1)) which recognizes the intrinsics and the names of such included files
begin with If the option is used, follows the chains of included files. With the option, ignores all chains of included files.
If the option is used, words found in local_file are removed from output. local_file is the name of a user-provided file containing a
sorted list of words, one per line. With this option, the user can specify a set of words that are correct spellings (in addition to
spell's own spelling list) for each job.
The spelling list is based on many sources, and while more haphazard than an ordinary dictionary, is also more effective with respect to
proper names and popular technical words. Coverage of the specialized vocabularies of biology, medicine, and chemistry is light.
Pertinent auxiliary files can be specified by name arguments, indicated below with their default settings (see FILES and VARIABLES).
Copies of all output are accumulated in the history file. The stop list filters out misspellings (such as that would otherwise pass.
Three routines help maintain and check the hash lists used by
Reads a list of words from the standard input and
writes the corresponding nine-digit hash code on the standard output. This program only accepts words that are up to
30 characters long. When words exceeding 30 characters are encountered, a diagnostic message is displayed on stan-
dard error.
Reads n hash codes from the standard input and writes a compressed spelling list on the standard output. Information about
the hash coding is printed on standard error.
Reads a compressed
spelling_list and recreates the nine-digit hash codes for all the words in it; it writes these codes on the standard
output.
EXTERNAL INFLUENCES
Environment Variables
Your hashed spelling list (default is
Spelling history (default is
Your hashed stop list (default is
Directory for temporary files; overrides the default
EXAMPLES
To check spelling of a single word:
If word is spelled correctly, a prompt is returned. If it is spelled incorrectly, word is printed before the prompt is returned. To check
spelling of multiple words, they can also be typed as a group on the same command line:
To create a personal spelling list that incorporates the words already present in the default American spelling list file
To modify the default British spelling list file replace all occurrences of with in the above example.
To add words to the default spelling list, change login to change the current working directory to and execute the commands listed in the
above example.
WARNINGS
The spelling list's coverage is uneven. When undertaking the use of as a new tool, it may be advisable to monitor the output for several
months to gather local additions. Typically, these are kept in a separate local file that is added to the hashed spelling_list via as
shown above.
The British spelling feature was developed by an American.
Start-up versions of files and are available in directory If these files or a suitable equivalent are not present in directory complains:
The command is likely to be withdrawn from X/Open standards. Applications using this command might not be portable to other vendors' sys-
tems.
FILES
Hashed spelling lists, American and British.
Hashed stop list.
History file.
Executable program file.
SEE ALSO deroff(1), sed(1), sort(1), tbl(1), tee(1).
STANDARDS CONFORMANCE spell(1)