Using the script: (Called replaceit)
#!/bin/ksh
String=$1
Replace=$2
sed -e "s/${orig}/${new}/g" oldfile.txt > newfile.txt
In oldfile.txt, I'm looking for: getenv("Work")
And change it To: /u/web
I execute the script:
replaceit "getenv(\""Work\"")" /u/web
I'm getting sed... (3 Replies)
how to escape / (forward slash) in a string.
I have following scnerio:
sed s/${var1}{$var2}
var1 and var2 both contain slashes, but sed gives error if there is a slash in var1 or var2. sed is used here to replace var1 with var2.
Thanks in advance (1 Reply)
Hi all,
I need to know way of inserting backward slash before forward slash. My problem is that i need to supply directory path as an argument while invoking cshell script. This argument is further used in script (i.e. sed is used to insert this path in some file). So i need to place \ in front... (2 Replies)
What is the significance of the forward slash(/) while specifying a directory?
cp -av /dir/ /opt/
and
cp -av /dir /opt
Does effectively the same job it seems? (2 Replies)
i need to replace '/' forward slash with \/(backward slash follwed by a forward slash) using sed command when the forward slash occurs as a first character in a file..
Tried something like this but doesn't seem to work.
find $1 -print0 | xargs -0 sed -i -e 's/^\//\\\//g'
Can someone... (19 Replies)
hi
hope somebody can help, there seems to be bit on the net about this, but still cant make it work the way i need.
i have a file live this
mm dd ff /dev/name1
mm dd ff /dev/name2
mm dd ff /dev/name3
mm dd ff /dev/name4
i need to update /dev/name1 etc to /newdev/new/name1 etc
so... (5 Replies)
I have some directories I am trying to sort. When I attempt to sort them and they are in this format, everything works great:
file
/vol/trees10
/vol/trees2
/vol/trees7
cat file |sort -ts -k2 -n
/vol/trees2
/vol/trees7
/vol/trees10
This makes thefiles in the order... (9 Replies)
I have existing pattern in the perl script as:
my $pattern = "^Line.*?:|^Errors*: |^SEVERE:.*?:|^Null pointer exception occurred";
and I wanted to include below keywords in my search pattern
"I/O exception" and "FileNotFoundException"the problem is when I include my pattern like
my... (5 Replies)
./split2.sh: line 1: split/ssl/pop3s.txt: No such file or directory
sort: cannot read: split/ssl/pop3s.txt: No such file or directory
Hi there,
I am pulling data from the following source:
ssl/http
ssl/http
ssl/http-alt
ssl/https
ssl/https
ssl/https
ssl/https
ssl/https
ssl/https... (3 Replies)
Discussion started by: alvinoo
3 Replies
LEARN ABOUT DEBIAN
ids2ngram
IDS2NGRAM(1) User Contributed Perl Documentation IDS2NGRAM(1)NAME
ids2ngram - generate n-gram data file from ids file
SYNOPSIS
ids2ngram [option]... ids_file...
DESCRIPTION
ids2ngram generates idngram file, which is a sorted [id1,..,idN,freq] array, from binary id stream files. Here, the id stream files are
always generated by mmseg or slmseg. Basically, it finds all occurrence of n-words tuples (i.e. the tuple of (id1,..,idN)), and sorts these
tuples by the lexicographic order of the ids make up the tuples, then write them to specified output file.
INPUT
The input file is presented as a binary id stream, which looks like:
[id0,...,idX]
OPTIONS
All the following options are mandatory.
-n,--NMax N
Generates N-gram result. ids2ngram does only support uni-gram, bi-gram, and trigram, so any number not in the range of 1..3 is not
valid.
-s,--swap swap-file
Specify the temporary intermediate file.
-o, --out output-file
Specify the result idngram file, e.g. the array of [id1, ..., idN, freq]
-p, --para N
Specify the maximum n-gram items per paragraph. ids2ngram writes to the temporary file on a per-paragraph basis. Every time it writes a
paragraph out, it frees the corresponding memory allocated for it. When your computer system permits, a higher N is suggested. This can
speed up the processing speed because of less I/O.
EXAMPLE
Following example will use three input idstream file idsfile[1,2,3] to generate the idngram file all.id3gram. Each para (internal map size
or hash size) would be 1024000, using swap file for temp result. All temp para result would eventually be merged to got the final result.
ids2ngram -n 3 -s /tmp/swap -o all.id3gram -p 1024000 idsfile1 idsfile2 idsfile3
AUTHOR
Originally written by Phill.Zhang <phill.zhang@sun.com>. Currently maintained by Kov.Chai <tchaikov@gmail.com>.
SEE ALSO mmseg(1), slmseg(1), slmbuild (1).
perl v5.14.2 2012-06-09 IDS2NGRAM(1)