05-02-2009
AWK limit for (length) function?
I am trying to use the following code:
awk '{s=$0;if(length(s) < 750){getline; s=s " " $0}printf("%s\n",s)}' filename
but an error shows that 'awk' is too long. Is there a limit to the awk length function? and what could be an alternate solution for long fixed width records?
The code removes a \n (new line feed) within a record without removing the record delimter.
Thanks!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Friends,
I am having a funny problem with grep. When I run
grep 'expr' file.txt
things work fine. But when try to get the line number using the -n option, i.e,
grep -n 'expr' file.txt
I get a message, "grep: 0652-226 Maximum line length of 2048 exceeded."
If the line has more than... (3 Replies)
Discussion started by: hnhegde
3 Replies
2. UNIX for Advanced & Expert Users
Hi,:cool:
can any body tell me what is the function to get the length of a string in unix?I have used functions like len,length,strlen, but they are not working.
cheers
RRK (3 Replies)
Discussion started by: ravi raj kumar
3 Replies
3. AIX
Hi,
I'm using AIX version 5.3 currently. I'm trying to create a user id, e.g. andyleong, which the system prompted the length is too long.
1. I would like to know is that the length of user id is limited to maximum 8 characters for AIX.
2. Is it apply to all versions of AIX?
If no... (2 Replies)
Discussion started by: meihua_t
2 Replies
4. UNIX for Dummies Questions & Answers
Hi!
Can you please help me with one question?
Does rexec command have some limitation of the length of the deliveded cmd?
Thanks in advance,
Anta (2 Replies)
Discussion started by: Anta
2 Replies
5. Cybersecurity
Hello,
I am currently trying to limit incoming UDP length 20 packets on a per IP basis to 5 a second using IPTables on a Linux machine (CentOS 5.2).
Basically, if an IP is sending more than 5 length 20 UDP packet a second to the local machine, I would like the machine to drop the excess... (1 Reply)
Discussion started by: tomboy123
1 Replies
6. Shell Programming and Scripting
Hi
I have many problems with a script. I have a script that formats a text file but always prints the same error when i try to execute it
The code is that:
{
if (NF==17){
print $0
}else{
fields=NF;
all=$0;
while... (2 Replies)
Discussion started by: fate
2 Replies
7. Programming
Is there any stabdard limitation on size of a code line in C code?
I am interesting in UNIX limitation, particulary on SUN.
Thanks! (8 Replies)
Discussion started by: alex_5161
8 Replies
8. Shell Programming and Scripting
Hi. I'm trying to learn sed. I want to limit the length of a string. I tried this:
sed -n 's/^\(...........................\).*/\1/p' textfile.txt This works fine, but how do I give it as a range rather than putting a hundred dots?
I'd like to limit the number of characters to 144 for... (3 Replies)
Discussion started by: troglodytes
3 Replies
9. Shell Programming and Scripting
Hi,
I am having script which contains many functions. Need to print each function name at the starting of the function. Like below,
functionname()
{
echo "functionname"
commands....
}
I've tried like below,
func=`grep "()" scriptname | cut -d "(" -f1`
for i in $func
do
nawk -v... (4 Replies)
Discussion started by: Sumanthsv
4 Replies
10. Web Development
Here is the first draft PHP function to check badges:
<?php
function check_badges($color, $uid, $limit = 300, $_DEBUG = true)
{
/*
* check_badges() version 0.1 by Neo 9 Jan 2019
* $_COOKIE is not used in this server-side code
* but may be used in the browser. ... (0 Replies)
Discussion started by: Neo
0 Replies
LEARN ABOUT OPENSOLARIS
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).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+--------------------+-----------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+--------------------+-----------------+
|Availability | SUNWgawk |
+--------------------+-----------------+
|Interface Stability | Volatile |
+--------------------+-----------------+
NOTES
Source for gawk is available on http://opensolaris.org.
Free Software Foundation Nov 3 1999 IGAWK(1)