Hi all,
I am having a bit of a hard time using awk. I must do something wrong, but I don't know what... Any help would be greatly appreciated!
I read a file, as follows :
It has thousands of lines like this. I wish to sort some data out, but only when column 5 (here an "A") is within a range of letters accessible via the variable data. data is a user input and can be any letters in the range A-Z, in any combinaison (i.e. "F", "ABCFIZ", "A-GX", "KJHGF", ...). So I do this :
That it is not working. If I put a single letter (e.g. $5 == "A"), it works just fine, but as long as I want a variable, it doesn't output anything. I tried A LOT of combinaison around the metacharacters [] , like : "'[$data]'", "'['$data']'", "'\[$data\]'", "'["$data"]'", etc and nothing works - and often yielded errors. I'm out of ideas, if anyone has a suggestion...
I may add, for precision sake, that the quoted awk code is within a much longer script, called from and programmed into tcsh.
Hi All,
I would like to assign the following values to each column in my file.
if $i is between 1 and -1 (ie -1 < $i < 1) then print A;
if $i is between -2 and -1 && 1 and 2 (ie. -2 < $i < -1 && 1 < $i < 2) then print B;
if $i is between -3 and -2 && 2 and 3 (ie. -3 < $i < -2 && 2 < $i < 3)... (1 Reply)
Hi,
My input has much more lines, but few of them are below
pin(IDF) {
direction : input;
drc_pinsigtype : signal;
pin(SELDIV6) {
direction : input;
drc_pinsigtype : ... (3 Replies)
Hi all,
I have a input like this
3AF9:3B01
and need to expand to the below output
3AF9
3AFA
3AFB
3AFC
3AFD
3AFE
3AFF
3B00
3B01
Please let me know the easiest way for achieving this. Thanks for the help in advance... (6 Replies)
I have this kind of file
ABC UUIIIIIIIIIIII ,
HJHKJKL
XYZ HHJJJJJJMMM
ABC BBOOIO,
PPLIOJK
XYZ NMJKJKK
ABC MMMM
ABC OPOPO
XYZ LLKLKLL
I need to get all data from ABC till XYZ
so output should be
UUIIIIIIIIIIII (6 Replies)
i have this problem:
i must hide a string with a character such as _ by command
WORD=string;
XXX=`echo $WORD | sed 's//_/g'
but after, users must send in input a character and i must to replace the _ with the input character or better i can do this
-$CHARS_INPUT
i have think to use command... (3 Replies)
hi,
I want to store from 102 character to 128 character to a variable of header record which can be identified as 'HDR' which is the first 3 characters in the same line of a same.txt file.
Please advise.
Thanks (4 Replies)
Hi
I am having file :
1|2443094 |FUNG SIU TO |CLEMENT
2|2443095 |FUNG KIL FO |REMENT
This file contains only 3 fields delimeted by "|". Last field is a decsription filed and it contains character "|". Due to this my output if breaking in 4 fields. I... (7 Replies)
Hello
I would like to make a character range like that :
echo "ABCDEF+1234" | grep -E ''or
echo "ABCDEF+1234" | grep -E ''or
echo "ABCDEF+1234" | grep -E ''Which should works on linux with english language
And works also on linux with french language ( english install and after add french )... (4 Replies)
I'd like to put paragraph breaks \n\n randomly between 5 - 10 occurrences of the dot character (.), for an entire text file. How to do that?
In other words, anywhere between every 5 -10 sentences, a new paragraph will generate. There are no other uses of the (.) except for sentence breaks in... (11 Replies)
Hi there,
I am trying to remove al letters after : character on specific columns from 10th column till 827. I used sed and cut to do so but I am sure there is better one liner someone can think of from unix community members.
Huge file but it has this structure (Total number of Columns =... (10 Replies)
Discussion started by: daashti
10 Replies
LEARN ABOUT LINUX
igawk
IGAWK(1) Utility Commands IGAWK(1)NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
Free Software Foundation Nov 3 1999 IGAWK(1)