06-12-2009
create a function that would return a binary value - check the returned value as in above.
Or better yet, just create a function that will return either $2 or $3, return this value - you'll do the array assignment of the return value.
Last edited by vgersh99; 06-12-2009 at 11:35 AM..
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I got a sample file like this.
$ cat test
12|13|100|s
12|13|100|s
100|13|100|s
12|13|100|s
I want to replace all 100 by 2000 only in 3rd field using "awk"
This is replacing all 100's :-(
$ awk -F "|" '{gsub( /100/,"2000");print}' test
12|13|2000|s
12|13|2000|s
2000|13|2000|s... (5 Replies)
Discussion started by: jkl_jkl
5 Replies
2. Shell Programming and Scripting
Hi
I am using awk to replace the 4th feild of the input line. My code is below:
REP_LINE=$(echo $Line | awk -v var=$REPL_DT '{$4=var; print}')
It does replaces but all words/phrases after the 4th feild are erased. Is there a way to modify the 4th feild of the input line and to have all... (7 Replies)
Discussion started by: sugan
7 Replies
3. Shell Programming and Scripting
I am writing a c++ program that has many calls of pow(input,2). I now realize that this is slowing down the program and these all should be input * input for greater speed.
There should be a simple way of doing this replacement throughout my file with awk, but I am not very familiar with awk.... (2 Replies)
Discussion started by: bluejayek
2 Replies
4. Shell Programming and Scripting
I need to replace specific field (x) in a table with new value (y):
Input:
1 2 3 4
5 x 6 7
8 9 0 0
Output:
1 2 3 4
5 y 6 7
8 9 0 0
I have no idea how to do this. (10 Replies)
Discussion started by: setepo
10 Replies
5. Shell Programming and Scripting
Hello everybody:
I want to replace any field $2 of any file line (f.i. test.txt) matching $1 with a shell variable.
$ cat test.txt
F 0
B A
H -12.33
Now I'm going to ask the value of variable B:
$ SEARCHVAR=B
$ OLDVAL=$(awk -v SEARCHVAR="$SEARCHVAR"... (4 Replies)
Discussion started by: basalt
4 Replies
6. Shell Programming and Scripting
Hi
I would like to apply this gawk command:
gawk '{$0=gensub(/\y+\y/,"","g"); print}' file
not to the whole $0 but just to the part of $0 that is between:
(a number)"> and </mrk>
Is it possible?
thanks for your help. (4 Replies)
Discussion started by: louisJ
4 Replies
7. Shell Programming and Scripting
I have some problem with this.
Need to change field #3 to 5 if field #1 = A and filed #2 =B
DataA C 6 T
C B 4 R
A B 3 T
D E 5 4
I would like to do two things if statement is true, but can not get it to work.
Here it prints column #3 if statement is true, and this works
awk '{if... (3 Replies)
Discussion started by: Jotne
3 Replies
8. Shell Programming and Scripting
Need an awk script to calculate the percentage of value field and replace
I have a input file called file.txt with the following content:
john|622.5674603562933|8|br:1;cn:3;fr:1;jp:1;us:2
andy|0.0|12|**:3;br:1;ca:2;de:2;dz:1;fr:2;nl:1
in fourth filed of input file, calulate percentage of each... (1 Reply)
Discussion started by: veeruasu
1 Replies
9. Shell Programming and Scripting
Hi Friends,
I have looked around the forums and over online but couldn't figure out how to deal with this problem
input.txt
gene1,axis1/0/1,axis2/0/1
gene1,axis1/1/2,axis2/1/2
gene1,axis1/2/3,axis2/2/3
gene2,axis1/3/4,axis2/3/4
Match on first column and if first column is... (1 Reply)
Discussion started by: jacobs.smith
1 Replies
10. Shell Programming and Scripting
Hi,
I have a file like below
PRUM,67016800 ,CC ,C1,67016800 , ,Y,Y,2 ,CK,BX,FOX ,00000001,EA,00000001,20141120 00:00:00, ,N,Y,Y,CK ABCDEF... (7 Replies)
Discussion started by: mady135
7 Replies
LEARN ABOUT DEBIAN
word-list-compress
WORD-LIST-COMPRESS(1) Aspell Abbreviated User's Manual WORD-LIST-COMPRESS(1)
NAME
word-list-compress - word list compressor/decompressor for GNU Aspell
SYNOPSIS
word-list-compress c[ompress] | d[ecompress]
DESCRIPTION
word-list-compress compresses or decompresses sorted word lists for use with the GNU Aspell spell checker.
COMMANDS
-c, c, compress
compress the plain text word list read from standard input.
-d, d, decompress
decompress the compressed word list read from standard input.
EXAMPLES
Here are a few examples of how you can use word-list-compress
word-list-compress d <wordlist.cwl >wordlist.txt
Decompress file wordlist.cwl to text file wordlist.txt
word-list-compress c <wordlist.wl >wordlist.cwl 2>errors.txt
Compress wordlist.wl to wordlist.cwl and send any error messages to a text file named errors.txt
LC_COLLATE=C sort -u <wordlist.txt | word-list-compress c >wordlist.cwl
Sort a word list, then pipe it to word-list-compress to create a compressed binary wordlist.cwl file.
word-list-compress d <words.cwl | aspell create master ./words.rws
Decompress a wordlist, then pipe it to aspell(1) to create a spelling list. Please check the aspell(1) info manual for proper usage
and options.
TIPS
Word-list-compress is best used with sorted word list type files. It is not a general purpose compression program since the resulting
files may actually increase in size.
Word-list-compress accepts up to 255 text characters in the range of {0x21...0xFF}. If your word list requires a larger character set for
certain languages or longer length for multi-word, scientific, medical, technical or other use, then it is recommended that you compress
your word list using prezip-bin(1)
DIAGNOSTICS
Word-list-compress normally exits with a return code of 0. If it encounters an error, a message is sent to standard error output (stderr),
and word-list-compress exits with a non-zero return value. Error messages are listed below:
(display help/usage message)
Unknown command given on the command line so word-list-compress displays a usage message to standard error output.
Corrupt Input
This is only for the decompression command d. The input file is of an unknown format or the input file/stream is corrupted. You
may have some valid output, but word-list-compress could not complete the process. If the input file is a compressed wordlist but
you have no output file, then it may be a newer prezip-bin(1) version of compressed file, if so, try decompressing the file with
prezip-bin(1) instead.
Output Data Error
The output is full, write protected, or has an error and can no longer be written to.
SEE ALSO
aspell(1), aspell-import(1), prezip-bin(1), run-with-aspell(1)
Aspell is fully documented in its Texinfo manual. See the `aspell' entry in info for more complete documentation.
REPORTING BUGS
For help, see the Aspell homepage at <http://aspell.net> and send bug reports/comments to the Aspell user list at the above address.
AUTHOR
This manual page was written by Aaron Lehmann <aaronl@vitelus.com>, Brian Nelson <pyro@debian.org> and Jose Da Silva <digital@joescat.com>.
GNU
2005-09-05 WORD-LIST-COMPRESS(1)