File indexing completed on 2024-04-21 05:41:33

0001 #!/bin/sh
0002 
0003 #
0004 # Copyright 2017 Maxim Golov <maxim.golov@gmail.com>
0005 #
0006 # This library is free software; you can redistribute it and/or
0007 # modify it under the terms of the GNU Lesser General Public
0008 # License as published by the Free Software Foundation; either
0009 # version 2.1 of the License, or (at your option) any later version.
0010 #
0011 # This library is distributed in the hope that it will be useful,
0012 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0014 # Lesser General Public License for more details.
0015 #
0016 # You should have received a copy of the GNU Lesser General Public
0017 # License along with this library; if not, write to the Free Software
0018 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
0019 #
0020 
0021 if [ -z "$1" ] || [ -z "$2" ] ; then
0022     echo "usage: $0 <input file> <output file>" 1>&2
0023     exit 1
0024 fi
0025 
0026 zcat $1 | awk '
0027     BEGIN { idx = 1 }
0028     {
0029         if (($1 ~ /s/) || ($1 ~ /X/))
0030             printf("%s string%d\n", $1, idx++);
0031         else
0032             print
0033     }
0034 ' | gzip >$2