Sponsored Content
Full Discussion: awk with echo list
Top Forums Shell Programming and Scripting awk with echo list Post 303045814 by Chubler_XL on Tuesday 14th of April 2020 03:19:58 AM
Old 04-14-2020
<( list ) (process substitution) not available is sh, your first example was probably using bash to run the script.

You could try this instead:

Code:
col_list='{print $64,$64,$52,$64,$64,$33}'
tail -n +"${record_pstn}" "${file_name}" | /usr/bin/awk "$col_list" FS="${ifs}" OFS="${ofs}"

Or roll the tail command into awk like this:

Code:
col_list='{print $64,$64,$52,$64,$64,$33}'
/usr/bin/awk "FNR >= ${record_pstn} $col_list" FS="${ifs}" OFS="${ofs}" "${file_name}"


Last edited by Chubler_XL; 04-14-2020 at 04:26 AM..
This User Gave Thanks to Chubler_XL For This Post:
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

echo is too slow. HELP with Awk

Hello All, Below is a simple script i worte to find the 208th char in a file. If the char = "C" then I re-direct the line to a file called change.txt. If it is not "C" then I re-direct it to a file called delete.txt. My problem is I have a file 0f 500K lines. this script is very slow. I am... (4 Replies)
Discussion started by: eja
4 Replies

2. Shell Programming and Scripting

awk to echo ???

Hi All, I have the below command. awk 'BEGIN {printf("%1s","cat")}' > temp.txt can i do the same using echo ?If So, how? Thanks JS (2 Replies)
Discussion started by: jisha
2 Replies

3. Shell Programming and Scripting

Using echo in AWK

Hello, I have written the script below to extract specific data from a text file and then use the data extracted as parameters for another shell script call 'loto_tsim'. Everytime I run my script it complains about the 'echo' line. Am I missing something? I have spent hours and still cannot solve... (10 Replies)
Discussion started by: jermaine4ever
10 Replies

4. Shell Programming and Scripting

perform echo and awk inside a string

hi, just wanted to make a shortcut of this one a="a b c" b=`echo $a | awk '{print $2}'` echo "the middle is $b" why can't i do this: a="a b c" echo "the middle is ${`echo $a | awk '{print $2}'`}" <- bad substitution :wall: thanks (6 Replies)
Discussion started by: h0ujun
6 Replies

5. Shell Programming and Scripting

Improve performance of echo |awk

Hi, I have a script which looks like this. Input file data1^20 data2^30 #!/bin/sh file"/home/Test.txt" while read line do echo $line |awk 'BEGIN { FS = "^" } ; { print $2 }' echo $line |awk 'BEGIN { FS = "^" } ; { print $1 }' | gzip | wc -c done <"$file" How can i... (4 Replies)
Discussion started by: chetan.c
4 Replies

6. Shell Programming and Scripting

Problem with writing to output - awk, echo

Hello all, I wrote this command line for some calculation on my given input files based on another input file which is a txt file. while read BAM REGION; do samtools view $BAM $REGION | awk '{if ($2==0) print $0}' | wc -l >>log.txt; echo "$REGION"; done >> log.txt <regions.txt It takes... (4 Replies)
Discussion started by: @man
4 Replies

7. Shell Programming and Scripting

Combining echo and awk

i have a script that has many lines similar to: echo $var | awk -F"--" '{print $2}' as you can see, two commands are being run here. echo and awk. id like to combine this into one awk statement. i tried: awk -F"--" "BEGIN{print $var; print $2}" but i get error messages. (10 Replies)
Discussion started by: SkySmart
10 Replies

8. Shell Programming and Scripting

Echo awk output from its variable

Stumped with the formatting of the awk output when used with variables, e.g.: awk -F, 'BEGIN {OFS=","} print {$2,$3,$4}' $infile1 produces the desired output (with rows), but when echoing the variable below, the output is one continuous line var1=$(awk -F, 'BEGIN {OFS=","} print... (4 Replies)
Discussion started by: ux4me
4 Replies

9. UNIX for Beginners Questions & Answers

Need to save output of echo and awk to a file

Hi, I am generating a YAML file from a hosts file, but am having trouble saving it to a new file. hosts file 127.0.0.1 localhost 192.168.1.2 host1 192.168.1.3 host2 192.168.1.4 host3 192.168.1.5 host4 YAML file $ echo 'host_entries:' && awk '{printf " %s:\n ip:... (3 Replies)
Discussion started by: sand1234
3 Replies
SIGSETOPS(3)						     Linux Programmer's Manual						      SIGSETOPS(3)

NAME
sigemptyset, sigfillset, sigaddset, sigdelset, sigismember - POSIX signal set operations. SYNOPSIS
#include <signal.h> int sigemptyset(sigset_t *set); int sigfillset(sigset_t *set); int sigaddset(sigset_t *set, int signum); int sigdelset(sigset_t *set, int signum); int sigismember(const sigset_t *set, int signum); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): sigemptyset(), sigfillset(), sigaddset(), sigdelset(), sigismember(): _POSIX_C_SOURCE >= 1 || _XOPEN_SOURCE || _POSIX_SOURCE DESCRIPTION
These functions allow the manipulation of POSIX signal sets. sigemptyset() initializes the signal set given by set to empty, with all signals excluded from the set. sigfillset() initializes set to full, including all signals. sigaddset() and sigdelset() add and delete respectively signal signum from set. sigismember() tests whether signum is a member of set. Objects of type sigset_t must be initialized by a call to either sigemptyset() or sigfillset() before being passed to the functions sigaddset(), sigdelset() and sigismember() or the additional glibc functions described below (sigisemptyset(), sigandset(), and sig- orset()). The results are undefined if this is not done. RETURN VALUE
sigemptyset(), sigfillset(), sigaddset(), and sigdelset() return 0 on success and -1 on error. sigismember() returns 1 if signum is a member of set, 0 if signum is not a member, and -1 on error. On error, these functions set errno to indicate the cause. ERRORS
EINVAL sig is not a valid signal. CONFORMING TO
POSIX.1-2001. NOTES
Glibc notes If the _GNU_SOURCE feature test macro is defined, then <signal.h> exposes three other functions for manipulating signal sets. int sigisemptyset(sigset_t *set); returns 1 if set contains no signals, and 0 otherwise. int sigorset(sigset_t *dest, sigset_t *left, sigset_t *right); places the union of the sets left and right in dest. int sigandset(sigset_t *dest, sigset_t *left, sigset_t *right); places the intersection of the sets left and right in dest. sigorset() and sigandset() return 0 on success, and -1 on failure. These functions are nonstandard (a few other systems provide similar functions) and their use should be avoided in portable applications. SEE ALSO
sigaction(2), sigpending(2), sigprocmask(2), sigsuspend(2) COLOPHON
This page is part of release 3.53 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2013-04-19 SIGSETOPS(3)
All times are GMT -4. The time now is 02:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy