Tag Info

New answers tagged

5

You have to use a named pipe for that. First create one in the folder: mkfifo foo.pipe Then use that command: tar cvf foo.pipe ./foo >foo.out 2>foo.err & cat foo.pipe >foo.tar Notice: the cat-part, can now also be gzip or whatever, that can read from a pipe: tar cvf foo.pipe ./foo >foo.out 2>foo.err & gzip -c foo.pipe ...


3

If your system supports /dev/fd/n: tar cvf /dev/fd/3 ./foo 3>&1 > foo.out 2>foo.err | squish > foo.tar.S Which with AT&T implementations of ksh (or bash or zsh) you could write using process substitution: tar cvf >(squish > foo.tar.S) ./foo > foo.out 2>foo.err That's doing exactly the same thing except that this time, ...


1

As you have all fields in first row of file you can use the following code: IFS='|' read -d ^ -a field < "$RUNTIME/EMAIL_$System`date +%y%m%d`.csv" Please note that ^ can be any symbol which surely should not meet in the text to operate it trough till the end. All necesary fields will be stored into array field starting from 0-element: field[0] , ...


0

Pure sed one-liner: sed ':X;N;s/*//;$!bX;s/\n /\t/g;:Y;s/\n\n//g;tY' $WORKFILE It may look quite complicated at first but basically it removes all *, then removes all newlines followed by two spaces ('\n ') and lastly removes double newlines \n\n to clean up. Most probably this expresion can be simplified. I included tab \t instead of spaces as field ...


0

I hope sole awk will be enough awk ' /syopsf00/{print ""} !/^[*]/{printf "%s",$0} END{print ""} ' $WORKFILE >> $OUTPUTFILE Or if you wants to strip multi-spaces and use awk-scriptfile: awk -f test.awk "$WORKFILE" >> "$OUTPUTFILE" where test.awk is: #!/usr/bin/awk -f /syopsf00/{print ""} !/^[*]/{printf ("%s",$1" "$2" "} ...


1

While (given your input) it's not quite clear what you're trying to do in full the problem with the output is that only the last line fed into awk will ever be printed because of the fact that you put the print in the END statement. It should look like this: BEGIN { RS="\n\n"; FS=" "; } { print $1,$2,$3,$4,$5; } Note: the indentation is just my ...


3

You get an error because you're attempting to do arithmetic equality with string values. Here are 2 ways to check whether the elements of dfArray are in dsmArray set -A dfArray / /usr /var /tmp ... set -A dsmArray /home /opt /usr ... for a in "${dfArray[@]}"; do in=false for b in "${dsmArray[@]}"; do if [[ $a == $b ]]; then echo "$a is in ...


6

From http://www.manpagez.com/man/1/ksh/: <>word Open file word for reading and writing as standard out- put. <&digit The standard input is duplicated from file descriptor digit (see dup(2)). Similarly for the standard output using >&digit. <&- ...


3

Appears so: $ command -v ksh /usr/bin/ksh $ what /usr/bin/ksh /usr/bin/ksh: Version M-11/16/88i SunOS 5.8 Generic 110662-24 Apr 2007 $ ksh $ x=08 $ y=$(( 10#$x - 1 )) $ echo "$x - $y" 08 - 7 From the "Arithmetic Evaluation" section of the man page: Constants are of the form [ base# ] n where base is a decimal number between ...


0

There are several great answers here, but none of them mention when not to use brace expansion. Like the other answerers, I use brace expansion on the command line quite a bit. I also use it in my aliases and functions since I can expect a smart shell. I do not use it in my shell scripts (unless there's some other reason the scripts should be bash or zsh, ...


3

Running sqlplus from a crontab entry can be frustrating. You get a very sparse PATH variable as the shell that crond forks off does not read the "rc" file. In your ".profile" file do you set ORACLE_HOME? Do you include $ORACLE_HOME/bin in the PATH, and export ORACLE_HOME and PATH? Check that first. Also, I have to note that your code shows the ksh in ...


4

ksh does not have pushd, popd as built-in. But it has an implementation for you. Try: . /usr/share/ksh/functions/pushd or: . /usr/share/ksh/functions/popd Then you can use pushd and popd. To make it permanent, you can source those files directly in your .kshrc or add them to FPATH environment variable.


4

The reason for this is ( has a different meaning. From the bash manpage: (list) list is executed in a subshell environment (see COMMAND EXECUTION ENVIRONMENT below). Variable assignments and builtin commands that affect the shell's environment do not remain in effect after the command ...



Top 50 recent answers are included