Changeset 273 in MondoRescue


Ignore:
Timestamp:
Jan 3, 2006, 4:09:12 PM (18 years ago)
Author:
bcornec
Message:

Patches from Sébastien Aperghis-Tramoni <maddingue@…>

replace several occurences of "cat .. | grep .."
or with similar commands that accept filenames as arguments.
+ some sort | uniq replaced by sort -u

Location:
branches/2.06
Files:
29 edited

Legend:

Unmodified
Added
Removed
  • branches/2.06/mindi/aux-tools/sbin/format-and-kludge-vfat

    r196 r273  
    110110umount /mnt/tmpK || Die "Can't unmount /mnt/tmpK"
    111111
    112 ideal_size=`cat /tmp/mountlist.txt | grep "$device " | tr -s ' ' ' ' | cut -d' ' -f4`
     112ideal_size=`grep "$device " /tmp/mountlist.txt | tr -s ' ' ' ' | cut -d' ' -f4`
    113113if [ "$ideal_size" = "" ]; then
    114114    LogIt "format-and-kludge-vfat --- can't find $device in mountlist" 1
  • branches/2.06/mindi/mindi

    r258 r273  
    244244        included_list=`gzip -dc $mappath | fgrep -i include | sed s/'"'// | sed s/'"'// | cut -d' ' -f2`
    245245    else
    246         included_list=`cat $mappath | fgrep -i include | sed s/'"'// | sed s/'"'// | cut -d' ' -f2`
     246        included_list=`fgrep -i include $mappath | sed s/'"'// | sed s/'"'// | cut -d' ' -f2`
    247247    fi
    248248    for included_item in $included_list ; do
     
    313313    if [ ! -f "$copy_from" ] ; then
    314314        LogIt "OK, you don't have a /boot/boot.b file, which is odd because\n most _good_ Linux distributions come with one, even if it's only a softlink"
    315         copy_from=`cat /etc/lilo.conf | grep install= | grep "\.b" | cut -d'=' -f2`
     315        copy_from=`grep install= /etc/lilo.conf | grep "\.b" | cut -d'=' -f2`
    316316        if [ ! -f "$copy_from" ] ; then
    317317            LogIt "Nor can I find it from your /etc/lilo.conf file. This is very odd.\n"
     
    505505    outdir=$2
    506506
    507     list_of_optimized_libraries=`cat $filelist | grep "lib/i[5-7]86/"`
     507    list_of_optimized_libraries=`grep "lib/i[5-7]86/" $filelist`
    508508    if [ "$list_of_optimized_libraries" = "" ] ; then
    509509    return 0
     
    526526    ln -sf $vanilla_lib_name $outdir$optimized_lib_name
    527527    echo "Excluding $optimized_lib_name" >> $LOGFILE
    528     cat $filelist | fgrep -vx "$optimized_lib_name" > $filelist.tmp
     528    fgrep -vx "$optimized_lib_name $filelist" > $filelist.tmp
    529529    echo "Replacing it with $vanilla_lib_name" >> $LOGFILE
    530530    echo "$vanilla_lib_name" >> $filelist.tmp
    531531    mv -f $filelist.tmp $filelist
    532532    done
    533     cat $filelist | sort | $AWK '{ print $1; }' | uniq > $filelist.tmp
     533    sort $filelist | $AWK '{ print $1; }' | uniq > $filelist.tmp
    534534    mv -f $filelist.tmp $filelist
    535535    echo -e "$DONE"
     
    584584    fi
    585585    echo "keyfile=$keyfile" >> $LOGFILE
    586     locale=`cat "$keyfile" |fgrep KEYTABLE | tr -d '"' |cut -d'=' -f2`
    587     [ ! "$locale" ] && locale=`cat "$keyfile" | grep '.map$' | sed 's/^.* //'`      # Slackware
     586    locale=`fgrep KEYTABLE "$keyfile" | tr -d '"' |cut -d'=' -f2`
     587    [ ! "$locale" ] && locale=`grep '.map$' "$keyfile" | sed 's/^.* //'`        # Slackware
    588588    echo "locale=$locale" >> $LOGFILE
    589589    mp=`find $KEYDIR/keymaps | grep "i[3-8]86" | fgrep "${locale}." | grep -vx " *#.*"`
     
    998998    local res currline partition all_partitions ap_orig remaining i j
    999999
    1000     cat $MY_FSTAB | grep -vx " *#.*" | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||LABEL\=\// && !/fdd|cdr|zip|floppy/ {print $1}'
     1000    grep -vx " *#.*" $MY_FSTAB | grep -vx " *none.*" | $AWK '/^\/dev\/[imhs]d||LABEL\=\// && !/fdd|cdr|zip|floppy/ {print $1}'
    10011001#    for partition in `$FDISK -l | tr -s ' ' '\n' | grep /dev` ; do
    10021002#        [ -e "$i" ] && all_partitions=echo "$i"
     
    14251425        echo "Unknown partition (outstring = $unofficial_outstring)" >> $LOGFILE
    14261426    elif [ "$partition_mountpt" = "" ] && [ -f "/etc/raidtab" ] ; then
    1427         if [ "`cat /etc/raidtab 2> /dev/null | fgrep device | fgrep $current_partition`" ] ; then
     1427        if [ "`fgrep device /etc/raidtab 2>/dev/null | fgrep $current_partition`" ] ; then
    14281428        partition_mountpt=raid
    14291429        partition_format=raid
     
    14711471    rmdir $1
    14721472    echo -en "  " > $1
    1473     if [ "`cat /etc/issue.net 2> /dev/null | fgrep -i "debian"`" ] ; then
    1474         cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cat /etc/issue.net | cut -d ' ' -f 3` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ >> $1.tmp
    1475     else
    1476         cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`cat /etc/issue.net | grep -i "linux" | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`cat /etc/issue.net | grep -i "kernel" | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' '\\r' 'on' 'an' '\/' '`uname -r`' 'on' 'an' '`uname -m`/ >> $1.tmp
     1473    if [ "`fgrep -i "debian" /etc/issue.net 2> /dev/null`" ] ; then
     1474        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cut -d ' ' -f 3 /etc/issue.net` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ >> $1.tmp
     1475    else
     1476        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`grep -i "linux" /etc/issue.net | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`grep -i "kernel" /etc/issue.net | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' '\\r' 'on' 'an' '\/' '`uname -r`' 'on' 'an' '`uname -m`/ >> $1.tmp
    14771477    fi
    14781478    cat $1.tmp | sed s/%r/"`uname -r`"/ | sed s/%t/"`hostname`"/ > $1
     
    16401640    local disksize
    16411641    disksize=$1
    1642     if [ "`cat /etc/issue.net 2> /dev/null | fgrep -i "debian"`" ] ; then
    1643         cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cat /etc/issue.net | cut -d ' ' -f 3` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/
    1644     else
    1645         cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`cat /etc/issue.net | grep -i "linux" | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`cat /etc/issue.net | grep -i "kernel" | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' 'r' 'on' 'an' 'm/' '`uname -r`' 'on' 'an' '`uname -m`/
     1642    if [ "`fgrep -i "debian" /etc/issue.net 2> /dev/null`" ] ; then
     1643        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s%DDDDD%"Debian GNU\/`uname -s` `cut -d ' ' -f 3 /etc/issue.net` `hostname`"% | sed s/KKKKK/"Kernel `uname  -r` on a `uname -m`"/ | sed s/TTTTT/"`LC_TIME=C date`"/
     1644    else
     1645        cat $MINDI_LIB/msg-txt | sed s/ZZZZZ/$MINDI_VERSION/ | sed s/YYYYY/"Mondo Rescue"/ | sed s/XXXXX/"a cousin of"/ | sed s/DDDDD/"`grep -i "linux" /etc/issue.net | head -n1 | tr -s ' ' ' '`"/ | sed s/KKKKK/"`grep -i "kernel" /etc/issue.net | head -n1 | tr -s ' ' ' '`"/ | sed s/TTTTT/"`LC_TIME=C date`"/ | sed s/' 'r' 'on' 'an' 'm/' '`uname -r`' 'on' 'an' '`uname -m`/
    16461646    fi
    16471647    if [ "$disksize" -gt "2880" ] ; then
     
    19441944    fi
    19451945    if [ $? -ne "0" ] ; then
    1946     if [ "`cat $LOGFILE | fgrep "/tmp/dev.0"`" ] ; then
     1946    if [ "`fgrep "/tmp/dev.0" $LOGFILE`" ] ; then
    19471947        LogIt "The '/tmp/dev.0' error is NOT Mindi's fault. It is LILO's.\n"
    19481948        LogIt "Please reboot your PC as a workaround.\n"
     
    21032103    tardir=$TMP_ROOT/tardir
    21042104
    2105     lines=`cat $MINDI_CONF/deplist.txt | grep -vx " *#.*" | grep -vx "" |wc -l`
     2105    lines=`grep -vx " *#.*" $MINDI_CONF/deplist.txt | grep -vx "" | wc -l`
    21062106    cat $MINDI_CONF/deplist.txt | GenerateGiantDependencyList $needlist $lines
    21072107    res=$?
     
    28762876    lsmod | cut -d' ' -f1 >> $fname
    28772877    lsmod | cut -d' ' -f1 >> $fname
    2878     modules=`cat $fname | sort | uniq -d2 | tr '\n' ' '`
     2878    modules=`sort $fname | uniq -d2 | tr '\n' ' '`
    28792879    rm -f $fname
    28802880    [ "$modules" ] && echo "Unsaved kernel modules: $modules" >> $LOGFILE
     
    29502950    FindLiloBinary
    29512951fi
    2952 cat /proc/mounts | fgrep " $TMP_ROOT " | fgrep tmpfs > /dev/null 2> /dev/null && TMP_ROOT=/home && LogIt "Changing TMP_ROOT to $TMP_ROOT because you're using tmpfs for /tmp\n" ; # tmpfs doesn't like Mindi and /tmp, for some reason
     2952fgrep " $TMP_ROOT " /proc/mounts | fgrep tmpfs > /dev/null 2> /dev/null && TMP_ROOT=/home && LogIt "Changing TMP_ROOT to $TMP_ROOT because you're using tmpfs for /tmp\n" ; # tmpfs doesn't like Mindi and /tmp, for some reason
    29532953rm -f /tmp/mindi_lo
    29542954trap "Aborted" SIGTERM
  • branches/2.06/mindi/rootfs/sbin/find-and-mount-cdrom

    r30 r273  
    77    for device in /dev/hd? /dev/scd? /dev/rcd? /dev/sr? /dev/cd? /dev/ide/*/*/*/*/cd /dev/scsi/*/*/*/*/cd; do
    88        [ ! "$SECOND_TRY" ] && LogIt "Trying $device"
    9         if [ "`cat /tmp/mondo-restore.cfg | grep "using-cdstream yes"`" ]; then
     9        if [ "`grep "using-cdstream yes" /tmp/mondo-restore.cfg`" ]; then
    1010        pwd=`pwd`
    1111        cd $GROOVY
     
    7777#mount /dev/fd0u1722 -t ext2 /mnt/floppy
    7878[ "$1" = "--second-try" ] && exit 1; # don't try to mount floppy drive
    79 if [ "`cat /tmp/mondo-restore.cfg | grep "using-cdstream yes"`" ] ; then
     79if [ "`grep "using-cdstream yes" /tmp/mondo-restore.cfg`" ] ; then
    8080    LogIt "Because you are using cdstream, I won't try to mount CD."
    8181    exit 0
  • branches/2.06/mindi/rootfs/sbin/post-init

    r232 r273  
    5959cat /tmp/mountlist.txt >> /tmp/mondo-restore.log
    6060
    61 iso=`cat /proc/cmdline | grep "iso"`
    62 nuke=`cat /proc/cmdline | grep "nuke"`
     61iso=`grep iso /proc/cmdline`
     62nuke=`grep nuke /proc/cmdline`
    6363if [ "$nuke" = "" ] ; then
    64     nuke=`cat /proc/cmdline | grep -i "RESTORE "`
     64    nuke=`grep -i "RESTORE " /proc/cmdline`
    6565fi
    66 expert=`cat /proc/cmdline | grep "expert"`
    67 compare=`cat /proc/cmdline | grep "compare"`
    68 interactive=`cat /proc/cmdline | grep "interactive"`
     66expert=`grep expert /proc/cmdline`
     67compare=`grep compare /proc/cmdline`
     68interactive=`grep interactive /proc/cmdline`
    6969[ "$interactive" ]  && expert=""; # in case 'expert' crops up somewhere
    7070if which mondorestore > /dev/null 2> /dev/null ; then
     
    112112    mondorestore --nuke
    113113elif [ "$expert" ] ; then
    114     if [ "`cat /tmp/mondo-restore.cfg | grep tapedev`" ] ; then
     114    if [ "`grep tapedev /tmp/mondo-restore.cfg`" ] ; then
    115115    LogIt "-------------------TAPE MODE-------------------" 1
    116116    loc=`which mondorestore 2> /dev/null`
     
    125125            fi
    126126    fi
    127     elif [ "`cat /tmp/mondo-restore.cfg | grep using-cdstream`" ] ; then
     127    elif [ "`grep using-cdstream /tmp/mondo-restore.cfg`" ] ; then
    128128        LogIt "------------------CDSTREAM MODE------------------" 1
    129129        loc=`which mondorestore 2> /dev/null`
  • branches/2.06/mondo/mondo/common/X-specific.cpp

    r30 r273  
    197197    kapp->quit();
    198198    printf ("---FATAL ERROR--- %s\n", error);
    199     system ("cat /var/log/mondo-archive.log | gzip -9 > /tmp/MA.log.gz 2> /dev/null");
     199    system ("gzip -9c /var/log/mondo-archive.log > /tmp/MA.log.gz 2> /dev/null");
    200200    printf ("If you require technical support, please contact the mailing list.\n");
    201201    printf ("See http://www.mondorescue.org for details.\n");
     
    252252  if (grep_for_me[0] != '\0')
    253253    {
    254       sprintf (command, "cat %s | grep \"%s\" | tail -n%d", filename,
    255            grep_for_me, NOOF_ERR_LINES);
     254      sprintf (command, "grep \"%s\" %s | tail -n%d",
     255           grep_for_me, filename, NOOF_ERR_LINES);
    256256    }
    257257  else
    258258    {
    259       sprintf (command, "cat %s | tail -n%d", filename, NOOF_ERR_LINES);
     259      sprintf (command, "tail -n%d %s", NOOF_ERR_LINES, filename);
    260260    }
    261261  fin = popen (command, "r");
  • branches/2.06/mondo/mondo/common/libmondo-devices.c

    r256 r273  
    14371437#else
    14381438    sprintf(command,
    1439             "cat /proc/filesystems | grep -v nodev | tr -s '\t' ' ' | cut -d' ' -f2 | tr -s '\n' ' '");
     1439            "grep -v nodev /proc/filesystems | tr -s '\t' ' ' | cut -d' ' -f2 | tr -s '\n' ' '");
    14401440#endif
    14411441
  • branches/2.06/mondo/mondo/common/libmondo-filelist.c

    r128 r273  
    656656  if (find_home_of_exe("setfacl"))
    657657    {
    658       sprintf(command, "cat %s | gzip -dc | setfacl --restore - 2>> %s", acl_fname, MONDO_LOGFILE);
     658      sprintf(command, "gzip -dc %s | setfacl --restore - 2>> %s", acl_fname, MONDO_LOGFILE);
    659659      log_msg(1, "command = %s", command);
    660660      retval = system(command);
     
    685685        log_msg(1,
    686686                "No masklist provided. I shall therefore set ALL attributes.");
    687         sprintf(command, "cat %s | gzip -dc | %s --restore - 2>> %s",
     687        sprintf(command, "gzip -dc %s | %s --restore - 2>> %s",
    688688                original_exat_fname, executable, MONDO_LOGFILE);
    689689        log_msg(1, "command = %s", command);
     
    712712    sort_file(masklist);
    713713    current_subset_file[0] = current_master_file[0] = '\0';
    714     sprintf(syscall_pin, "cat %s | gzip -dc", original_exat_fname);
     714    sprintf(syscall_pin, "gzip -dc %s", original_exat_fname);
    715715    sprintf(syscall_pout, "%s --restore - 2>> %s", executable,
    716716            MONDO_LOGFILE);
     
    833833  if (find_home_of_exe("setfattr"))
    834834    {
    835       sprintf(command, "cat %s | gzip -dc | setfattr --restore - 2>> %s", acl_fname, MONDO_LOGFILE);
     835      sprintf(command, "gzip -dc %s | setfattr --restore - 2>> %s", acl_fname, MONDO_LOGFILE);
    836836      log_msg(1, "command = %s", command);
    837837      retval = system(command);
  • branches/2.06/mondo/mondo/common/libmondo-files.c

    r234 r273  
    845845    sprintf(mountlist, "%s/mountlist.txt", tmpdir);
    846846    sprintf(command,
    847             "cat %s/mountlist.txt | grep \"%s \" | head -n1 | awk '{print $4;}'",
    848             tmpdir, dev);
     847            "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'",
     848            dev, tmpdir);
    849849    log_it(command);
    850850    strcpy(sz_res, call_program_and_get_last_line_of_output(command));
  • branches/2.06/mondo/mondo/common/libmondo-raid.c

    r128 r273  
    8080
    8181    command = malloc(MAX_STR_LEN * 2);
    82     strcpy(command, "cat /proc/mdstat | grep \"");
     82    strcpy(command, "grep \" /proc/mdstat");
    8383    if (raidno == -1) {
    8484        strcat(command, "linear");
  • branches/2.06/mondo/mondo/common/libmondo-tools.c

    r196 r273  
    335335           "for i in `find /root /home -type d -name Desktop -maxdepth 2`; do \
    336336file=$i/.directory; if [ -f \"$file\" ] ; then mv -f $file $file.old ; \
    337 cat $file.old | awk '{if (index($0, \"rootimagesmindi\")) { while (length($0)>2) { getline;} ; } \
    338 else { print $0;};}' > $file ; fi ; done");
     337awk '{if (index($0, \"rootimagesmindi\")) { while (length($0)>2) { getline;} ; } \
     338else { print $0;};}'$file.old > $file ; fi ; done");
    339339    run_program_and_log_output(tmp, 5);
    340340    paranoid_free(tmp);
     
    10981098#ifndef __FreeBSD__
    10991099    if (run_program_and_log_output
    1100         ("cat /proc/devices | grep ramdisk", FALSE)) {
     1100        ("grep ramdisk /proc/devices", FALSE)) {
    11011101        if (!ask_me_yes_or_no
    11021102            ("Your kernel has no ramdisk support. That's mind-numbingly stupid but I'll allow it if you're planning to use a failsafe kernel. Are you?"))
     
    13901390    log_msg(4, "Done. Great. Seeting command to something");
    13911391    strcpy(command,
    1392            "cat /etc/fstab | grep -v \":\" | grep -vx \"#.*\" | grep -w \"/boot\" | tr -s ' ' '\t' | cut -f1 | head -n1");
     1392           "grep -v \":\" /etc/fstab | grep -vx \"#.*\" | grep -w \"/boot\" | tr -s ' ' '\t' | cut -f1 | head -n1");
    13931393    log_msg(4, "Cool. Command = '%s'", command);
    13941394    strcpy(tmp, call_program_and_get_last_line_of_output(command));
  • branches/2.06/mondo/mondo/common/libmondo-verify.c

    r128 r273  
    159159
    160160/*  sprintf (command,
    161        "cat %s | grep \"afio: \" | awk '{j=substr($0,8); i=index(j,\": \");printf \"/%%s\\n\",substr(j,1,i-2);}' | sort | uniq | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"/dev/.*\" > %s",
     161       "grep \"afio: \" %s | awk '{j=substr($0,8); i=index(j,\": \");printf \"/%%s\\n\",substr(j,1,i-2);}' | sort -u | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"/dev/.*\" > %s",
    162162       stderr_fname, afio_found_changes);
    163163*/
     
    165165    log_msg(1, "Now scanning log file for 'afio: ' stuff");
    166166    sprintf(command,
    167             "cat %s | grep \"afio: \" | sed 's/afio: //' | grep -vx \"/dev/.*\" >> %s",
     167            "grep \"afio: \" %s | sed 's/afio: //' | grep -vx \"/dev/.*\" >> %s",
    168168            stderr_fname, afio_found_changes);
    169169    log_msg(2, command);
     
    175175    log_msg(1, "Now scanning log file for 'star: ' stuff");
    176176    sprintf(command,
    177             "cat %s | grep \"star: \" | sed 's/star: //' | grep -vx \"/dev/.*\" >> %s",
     177            "grep \"star: \" %s | sed 's/star: //' | grep -vx \"/dev/.*\" >> %s",
    178178            stderr_fname, afio_found_changes);
    179179    log_msg(2, command);
     
    185185    afio_diffs = count_lines_in_file(afio_found_changes);
    186186    sprintf(command,
    187             "cat %s %s %s | sort | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s",
     187            "sort %s %s %s | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s",
    188188            ignorefiles_fname, afio_found_changes, afio_found_changes,
    189189            changedfiles_fname);
     
    401401                    g_current_media_number, bigfile_num, slice_num);
    402402            if (bkpinfo->compression_level > 0) {
    403                 sprintf(command, "cat %s | %s -dc 2>> %s",
     403                sprintf(command, "%s -dc %s 2>> %s",
     404                        sz_exe,
    404405                        slice_fname(bigfile_num, slice_num, mountpoint,
    405                                     bkpinfo->zip_suffix), sz_exe,
     406                                    bkpinfo->zip_suffix),
    406407                        MONDO_LOGFILE);
    407408            } else {
     
    543544        sprintf(command, "cat %s >> %s", outlog, MONDO_LOGFILE);
    544545    } else {
    545         sprintf(command, "cat %s | cut -d':' -f%d | sort | uniq", outlog,
    546                 (bkpinfo->use_star) ? 1 : 2);
     546        sprintf(command, "cut -d: -f%d %s | sort -u",
     547                (bkpinfo->use_star) ? 1 : 2, outlog);
    547548        pin = popen(command, "r");
    548549        if (pin) {
     
    580581    }
    581582    /*  chdir(old_pwd); */
    582     //  sprintf (tmp, "cat %s | uniq -u >> %s", "/tmp/mondo-verify.err", MONDO_LOGFILE);
     583    //  sprintf (tmp, "uniq -u %s >> %s", "/tmp/mondo-verify.err", MONDO_LOGFILE);
    583584    //  paranoid_system (tmp);
    584585    //  unlink ("/tmp/mondo-verify.err");
     
    11481149            (int) (random() % 32767));
    11491150    sprintf(tmp,
    1150             "cat %s | grep -x \"%s:.*\" | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"dev/.*\"  > %s",
    1151             MONDO_LOGFILE, (bkpinfo->use_star) ? "star" : "afio",
     1151            "grep -x \"%s:.*\" %s | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vx \"/afio:.*\" | grep -vx \"dev/.*\"  > %s",
     1152            (bkpinfo->use_star) ? "star" : "afio", MONDO_LOGFILE,
    11521153            changed_files_fname);
    11531154    log_msg(2, "Running command to derive list of changed files");
  • branches/2.06/mondo/mondo/common/newt-specific.c

    r213 r273  
    424424        printf("---FATALERROR--- %s\n", error_string);
    425425        system
    426             ("cat /var/log/mondo-archive.log | gzip -9 > /tmp/MA.log.gz 2> /dev/null");
     426            ("gzip -9c /var/log/mondo-archive.log > /tmp/MA.log.gz 2> /dev/null");
    427427        printf
    428428                ("If you require technical support, please contact the mailing list.\n");
  • branches/2.06/mondo/mondo/mondo-makefilelist

    r30 r273  
    9999    done
    100100# exclude lost+found folders, Win9x hibernation file and Win9x swap file
    101     cat $TMP/filelist | sort | uniq | \
     101    sort $TMP/filelist -u | \
    102102grep -v "/win386\.swp" | grep -v "/vmmhiber\.w9x" | \
    103103grep -v "/hiberfil\.sys" | grep -v "/win386.swp" | grep -v "/pagefile\.sys" | \
     
    108108# End patch
    109109#     for i in `cat /etc/fstab | tr -s '\t' ' ' | cut -d' ' -f2` ; do
    110         cat $output | grep -vx "$i/lost+found" | grep -vx $i"lost+found" > $output.MID
     110        grep -vx "$i/lost+found" $output | grep -vx $i"lost+found" > $output.MID
    111111        sync
    112112        mv -f $output.MID $output
     
    114114# exclude .journal files (ext3)
    115115    for i in `cat /etc/fstab | tr -s '\t' ' ' | grep "ext3" | cut -d' ' -f2` ; do
    116     cat $output | grep -vx "$i/\.journal" | grep -vx "$i\.journal" | grep -vx "$i\.autofsck" > $output.MID
     116    grep -vx "$i/\.journal" $output | grep -vx "$i\.journal" | grep -vx "$i\.autofsck" > $output.MID
    117117        sync
    118118    mv -f $output.MID $output
    119119    done
    120120# exclude /var/log/pacct and Mondo's temp files
    121     cat $output | grep -vx "" | grep -v "/var/log/pacct" | grep -v "tmp\.mondo\.$$" | grep -vx "/var/log/mondo-archive\.log" | grep -v "mondo\.scratch\.$$" > $output.MID
     121    grep -vx "" $output | grep -v "/var/log/pacct" | grep -v "tmp\.mondo\.$$" | grep -vx "/var/log/mondo-archive\.log" | grep -v "mondo\.scratch\.$$" > $output.MID
    122122    mv -f $output.MID $output
    123123    cp -f $output $TMP/filelist
    124124# exclude /var/run/*.pid (lockfiles)
    125 #    cat $output | grep -vx "/var/run/[^\.]*\.pid" > $output.MID
     125#    grep -vx "/var/run/[^\.]*\.pid" $output > $output.MID
    126126#    mv -f $output.MID $output
    127127}
     
    180180for X in $EXCLUDE_PATHS  ; do
    181181    if [ ! -d $X ] ; then
    182     cat $TMP/filelist.blah | grep -v $X > $TMP/filelist.full
     182    grep -v $X $TMP/filelist.blah > $TMP/filelist.full
    183183    mv -f $TMP/filelist.full $TMP/filelist.blah
    184184    fi
    185185done
    186 cat $TMP/filelist.blah | grep -v "mojo-jojo-123" > $TMP/filelist.full
     186grep -v "mojo-jojo-123" $TMP/filelist.blah > $TMP/filelist.full
    187187[ ! -e "$TMP/filelist.full" ] && FatalError "Serious error when removing mojo jojo from fielist"
    188188cp $TMP/filelist.full /tmp
  • branches/2.06/mondo/mondo/mondoarchive/mondo-cli.c

    r213 r273  
    869869        &&
    870870        !run_program_and_log_output
    871         ("cat /etc/issue.net | grep -i suse | grep 64", TRUE)) {
     871        ("grep -i suse /etc/issue.net | grep 64", TRUE)) {
    872872        bkpinfo->make_cd_use_lilo = TRUE;
    873873        log_to_screen
  • branches/2.06/mondo/mondo/mondorestore/mondo-restore.c

    r251 r273  
    30983098    fatal_error("This will fail");
    30993099    sprintf(command,
    3100             "cat %s | grep -x \"%s.*\" > %s",
    3101             g_filelist_full, restore_this_directory, g_filelist_full);
     3100            "grep -x \"%s.*\" %s > %s",
     3101            restore_this_directory, g_filelist_full, g_filelist_full);
    31023102    if (system(command)) {
    31033103        retval++;
     
    31083108    fatal_error("This will fail");
    31093109    sprintf(command,
    3110             "cat %s | grep -x \"%s.*\" > %s",
    3111             g_biggielist_txt, restore_this_directory, g_biggielist_txt);
     3110            "grep -x \"%s.*\" %s > %s",
     3111            restore_this_directory, g_biggielist_txt, g_biggielist_txt);
    31123112    if (system(command)) {
    31133113        log_msg(1,
  • branches/2.06/mondo/mondo/mondorestore/mondo-rstr-newt.c

    r128 r273  
    605605    assert(raidrec != NULL);
    606606    system
    607         ("cat /proc/mdstat | grep Pers > /tmp/raid-personalities.txt 2> /dev/null");
     607        ("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null");
    608608    strcpy(personalities,
    609609           last_line_of_file("/tmp/raid-personalities.txt"));
  • branches/2.06/mondo/mondo/mondorestore/mondo-rstr-tools.c

    r253 r273  
    400400            f, file);
    401401    log_msg(2, tmp);
    402     sprintf(command, "cat %s | grep -x \"%s\"", list_fname, file);
     402    sprintf(command, "grep -x \"%s\" %s", file, list_fname);
    403403    res = run_program_and_log_output(command, FALSE);
    404404    paranoid_free(command);
     
    558558    }
    559559    sprintf(newfile_fname, "%s/rc.local.mondorescue", path);
    560     sprintf(tmp, "cat %s | grep mondorescue > /dev/null 2> /dev/null",
     560    sprintf(tmp, "grep mondorescue %s > /dev/null 2> /dev/null",
    561561            rclocal_fname);
    562562    if (system(tmp)) {
     
    569569\\n\
    570570\\n\
    571 cat %s | grep -v mondorescue > %s\\n\
     571grep -v mondorescue %s > %s\\n\
    572572rm -f /var/lock/subsys/*xfs*\\n\
    573573rm -f /var/run/xfs.*\\n\
     
    13711371            paranoid_system(command);
    13721372        }
    1373         sprintf(command, "cat %s | grep  -x \"/dev/.*\" > %s",
     1373        sprintf(command, "grep  -x \"/dev/.*\" %s > %s",
    13741374                g_biggielist_txt, g_filelist_imagedevs);
    13751375        paranoid_system(command);
  • branches/2.06/mondo/mondo/post-nuke.sample/usr/bin/post-nuke

    r30 r273  
    3636    sz_add="$3"
    3737    > $newfile
    38     cat $oldfile | grep -v "$sz_exclude.*" >> $newfile
     38    grep -v "$sz_exclude.*" $oldfile >> $newfile
    3939    echo "$sz_add" >> $newfile
    4040}
  • branches/2.06/mondo/mondo/restore-scripts/mondo/compare-me

    r30 r273  
    104104    padded_bfnum=`printf "%07d" $bf_num`
    105105    slice_fname=`GiveSliceName $bf_num $slice_num`
    106     checksum=`cat $slice_fname | cut -f1`
    107 #    finalsize=`cat $slice_fname | cut -f2`
    108     i=`cat $slice_fname | cut -f3`
     106    checksum=`cut -f1 $slice_fname`
     107#    finalsize=`cut -f2 $slice_fname`
     108    i=`cut -f3 $slice_fname`
    109109    outputfile=/mnt/RESTORING/"$i"
    110110    echo -n "$i "
     
    164164        outcome=$?
    165165            retval=$(($retval+$outcome))
    166         cat /tmp/rsm.log | grep -v "ignored" > /tmp/rsm.2.log
     166        grep -v ignored /tmp/rsm.log > /tmp/rsm.2.log
    167167        if [ "$outcome" -ne "0" ] ; then
    168168        echo -e -n "                                                                            \r"
     
    261261fi
    262262
    263 cat /tmp/compare-me.log \
    264 | grep -v -x "Files [^:]*:-" \
     263grep -v -x "Files [^:]*:-" /tmp/compare-me.log \
    265264| sort | uniq > /tmp/suspect.files
    266265
  • branches/2.06/mondo/mondo/restore-scripts/mondo/grub-MR

    r196 r273  
    6464    BOOTPATHNAME=""
    6565    for sz in /boot / ; do
    66     bootpart=`cat $2 | grep " $sz " | cut -d' ' -f1 | head -n1`
     66    bootpart=`grep " $sz " $2 | cut -d' ' -f1 | head -n1`
    6767    [ "$bootpart" ] && [ -e "/mnt/RESTORING/$bootpart" ] && break
    6868    done
     
    164164if echo $bootpart | grep "/md" > /dev/null ; then
    165165    base=`basename $bootpart`
    166     line=`cat /proc/mdstat | grep $base | head -n1`
     166    line=`grep $base /proc/mdstat | head -n1`
    167167    echo "mbrpart was $mbrpart"
    168168    mbrpart=`parted2fdisk -l | grep /dev/ | head -n1 | tr ':' ' ' \
  • branches/2.06/mondo/mondo/restore-scripts/mondo/hack-fstab

    r30 r273  
    3030    size=`echo "$incoming"       | cut -d' ' -f4`
    3131#    echo "'$device' '$mountpoint' '$format' '$size'" > /dev/stderr
    32     original_fstab_line=`cat $old_fstab | grep " $mountpoint " | grep -v "#" | tr -s ' ' ' '`
     32    original_fstab_line=`grep " $mountpoint " $old_fstab | grep -v "#" | tr -s ' ' ' '`
    3333#    echo "original_fstab_line = $original_fstab_line" >> /dev/stderr
    34     if [ "`cat $old_fstab | grep "LABEL="`" != "" ] ; then
     34    if [ "`grep "LABEL=" $old_fstab`" != "" ] ; then
    3535    if [ "$format" = "ext2" ] || [ "$format" = "ext3" ] ; then
    3636        device="LABEL=$mountpoint"
     
    8989    col2=`echo "$incoming" | cut -f2`
    9090    col_rest=`echo "$incoming" | cut -f3-19 | tr -s ' ' ' '`
    91     orig="`cat $old_fstab | grep " $col2 " | cut -f1`"
     91    orig="`grep " $col2 " $old_fstab | cut -f1`"
    9292    if [ "`echo "$orig" | grep "LABEL="`" != "" ] ; then
    9393    echo "orig = $orig" >> /dev/stderr
  • branches/2.06/mondo/mondo/restore-scripts/mondo/hack-lilo

    r30 r273  
    5454    newdev=`GetNewFstabMountpoint $dev`
    5555    if [ ! "$newdev" ] ; then
    56     col2=`cat $old_mountlist | grep "$dev " | cut -d' ' -f2`
    57     col1_new=`cat $new_mountlist | grep " $col2 " | cut -d' ' -f1`
     56    col2=`grep "$dev " $old_mountlist | cut -d' ' -f2`
     57    col1_new=`grep " $col2 " $new_mountlist | cut -d' ' -f1`
    5858    newdev="$col1_new"
    5959    if [ ! "$newdev" ] ; then
     
    6161    fi
    6262    fi
    63 #    old_fstab_line=`cat $new_fstab | grep "$dev"`
     63#    old_fstab_line=`grep "$dev" $new_fstab`
    6464    [ "$2" = "other" ] || echo -e -n "\t"
    6565    echo -e "$2=$newdev"
     
    135135ProcessLilo < $old_lilo >> $outfile
    136136chmod 600 $outfile
    137 cat $bootlistfile | sort | uniq > $bootlistfile
     137sort -u $bootlistfile -o $bootlistfile
    138138
    139139#------ disabled 12/10/01 (doesn't do anything anyway *g*)
  • branches/2.06/mondo/mondo/restore-scripts/mondo/label-partitions-as-necessary

    r30 r273  
    2828    mountline=`mount | grep " $label "`
    2929#   mountpt=`echo "$mountline" | cut -d' ' -f1`
    30 !   mountpt=`cat $mountlist | grep " $label " | cut -d' ' -f1`
     30!   mountpt=`grep " $label " $mountlist | cut -d' ' -f1`
    3131        if [ ! "$mountpt" ] ; then
    3232            LogIt "Not labeling anything as $label because $mountpt is not a mountpoint"
  • branches/2.06/mondo/mondo/restore-scripts/mondo/make-me-bootable

    r196 r273  
    1919HAVE_ACTIVE="false"
    2020for i in `cat $1 | tr -s '\t' ' ' | cut -d' ' -f1 | grep -v "/dev/fd" | grep -v "none" | grep -v "#"` ; do
    21     mountpt=`cat $1 | grep "$i " | tr -s '\t' ' ' | cut -d' ' -f2`
    22     format=`cat $1 | grep "$i " | tr -s '\t' ' ' | cut -d' ' -f3`
     21    mountpt=`grep "$i " $1 | tr -s '\t' ' ' | cut -d' ' -f2`
     22    format=`grep "$i " $1 | tr -s '\t' ' ' | cut -d' ' -f3`
    2323    drive=`echo $i | sed -e 's/[0-9]*$//' -e 's/\([0-9]\)p$/\1/'`
    2424    partno=`echo $i | sed -e 's/^.*[^0-9]\([0-9]*\)$/\1/'`
  • branches/2.06/mondo/mondo/restore-scripts/mondo/mount-me

    r30 r273  
    1414fi
    1515
    16 paths=`cat $mountlist | grep -v " raid " | grep -v "lvm lvm" | tr -s ' ' ' ' | cut -d' ' -f2 | sort`
     16paths=`grep -v " raid " $mountlist | grep -v "lvm lvm" | tr -s ' ' ' ' | cut -d' ' -f2 | sort`
    1717> $mountlist.sorted
    1818for i in $paths ; do
  • branches/2.06/mondo/mondo/restore-scripts/mondo/restore-bigfiles-from-iso

    r30 r273  
    4141        echo -en "."
    4242        if echo "$slicename" | grep "slice-[0-9]*.00000\.dat" 2> /dev/null; then
    43             CHECKSUM=`cat $slicename | head -n1 | cut -f1`
    44             OUTFNAME=`cat $slicename | head -n1 | cut -f2`
     43            CHECKSUM=`head -n1 $slicename | cut -f1`
     44            OUTFNAME=`head -n1 $slicename | cut -f2`
    4545            OUTFNAME=`echo "$restorepath/$OUTFNAME" | tr -s '/' '/'`
    4646            echo "Now restoring $OUTFNAME"
  • branches/2.06/mondo/mondo/restore-scripts/mondo/stablilo-me

    r30 r273  
    9191
    9292WhatIsFirstDriveCalled() {
    93     cat /tmp/mountlist.txt | cut -d' ' -f1 \
     93    cut -d' ' -f1 /tmp/mountlist.txt \
    9494| sed s/[0-9]// | sed s/[0-9]// \
    9595| sort | uniq | head -n 1
  • branches/2.06/mondo/mondo/restore-scripts/mondo/unmount-me

    r30 r273  
    1717done
    1818
    19 for i in `cat /proc/swaps | cut -d' ' -f1 | grep /dev`; do
     19for i in `cut -d' ' -f1 /proc/swaps | grep /dev`; do
    2020    swapoff $i
    2121done
  • branches/2.06/mondo/mondo/xmondo/xmondorestore.cpp

    r30 r273  
    55    copyright            : (C) 2003 by Joshua Oreman
    66    email                : oremanj@get-linux.org
    7     cvsid                : $Id: xmondorestore.cpp,v 1.1 2004/06/10 16:13:06 hugo Exp $
     7    cvsid                : $Id$
    88 ***************************************************************************/
    99
     
    275275    if (!r->rFilter->text().isEmpty() && !r->rFilter->text().isNull()) {
    276276    r->fStatusMsg->setText (QString ("Filtering filelist through regexp <tt>%1</tt>...").arg (r->rFilter->text()));
    277     if (system (QString ("cat %1 | egrep '%2' > %3.FILT").arg (g_filelist_full).arg (r->rFilter->text()).arg (g_filelist_full).ascii()) != 0) {
     277    if (system (QString ("egrep '%2' %1 > %3.FILT").arg (g_filelist_full).arg (r->rFilter->text()).arg (g_filelist_full).ascii()) != 0) {
    278278        r->fStatusMsg->setText ("Filter failed, using whole filelist");
    279279        rename (g_filelist_full, QString ("%1.FILT").arg (g_filelist_full).ascii());
Note: See TracChangeset for help on using the changeset viewer.