Sponsored Content
Top Forums Shell Programming and Scripting awk diamond code golf (just for fun!) Post 302986530 by pilnet101 on Saturday 26th of November 2016 04:17:46 PM
Old 11-26-2016
Wow Scrutinizer, very nice! Now I have to try and get my head round your code Smilie
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Diamond operator in Until Statement (perl)

Hello: I have the following perl script which is giving me trouble inside the second elsif statement. The purpose of the script is to go through a file and print out only those lines which contain pertinent information. The tricky part came when I realized that certain items actually spanned... (5 Replies)
Discussion started by: erichpowell
5 Replies

2. Shell Programming and Scripting

Fun with awk

uggc://ra.jvxvcrqvn.bet/jvxv/EBG13 #!/usr/bin/awk -f BEGIN { for (n=0;n<26;n++) { x=sprintf("%c",n+65); y=sprintf("%c",(n+13)%26+65) r=y; r=tolower(y) } } { b = "" for (n=1; x=substr($0,n,1); n++) b = b ((y=r)?y:x) print b } ... (0 Replies)
Discussion started by: colemar
0 Replies

3. Shell Programming and Scripting

More fun with awk

#!/usr/bin/ksh ls -l $@ | awk ' /^-/ { l = 5*log($5) h = sprintf("%7d %-72s",$5,$8) print "\x1B ls command with histogram of file sizes. The histogram scale is logaritmic, to avoid very short bars for smaller files or very long bars for bigger files. Screenshot: (4 Replies)
Discussion started by: colemar
4 Replies

4. Shell Programming and Scripting

Perl Diamond Operator

I know that when using 'while (<FILE>) {}', Perl reads only one line of the file at one time, and store it in '$_'. Can I change some parameters so that 'while (<>) {}' can read more than one lines, like 2 or 5 lines at one time? Thanks for the help! (1 Reply)
Discussion started by: zx1106
1 Replies

5. UNIX for Dummies Questions & Answers

fun and easy awk question

I have a file called mytitles.txt containing a list of book titles I have a second file called abfile.txt containing a list of book titles (in the 3rd field) and it has author info and copyright year info as well.. I want to search mytitles.txt for a match in the 3rd field of abfiles.txt, and... (2 Replies)
Discussion started by: glev2005
2 Replies

6. What is on Your Mind?

Place your bets! - Ryder Cup 2012 (Golf)

Who will win the 2012 Ryder Cup. Europe vs USA There is an open event in the Event Prediction Forum. The event closes on 27th Sep 2012. 2012 Ryder Cup - Wikipedia, the free encyclopedia (0 Replies)
Discussion started by: ni2
0 Replies

7. Shell Programming and Scripting

To print diamond asterisk pattern based on inputs

I have to print the number of stars that increases on each line from the minimum number until it reaches the maximum number, and then decreases until it goes back to the minimum number. After printing out the lines of stars, it should also print the total number of stars printed. I have tried... (13 Replies)
Discussion started by: rohit_shinez
13 Replies
nice(3) 						     Library Functions Manual							   nice(3)

NAME
nice - Changes the scheduling priority of a process LIBRARY
Standard C Library (libc) Berkeley Compatibility Library (libbsd) SYNOPSIS
#include <unistd.h> int nice( int increment); STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: nice(): XSH4.2 Refer to the standards(5) reference page for more information about industry standards and associated tags. PARAMETERS
Specifies a value that is added to the current process priority. You can specify a negative value. DESCRIPTION
The nice() function adds the value specified in the increment parameter to the nice value of the calling process. The nice value is a non- negative number; a higher nice value gives the process a lower CPU priority. When you are using the Standard C Library version of the nice() function, the maximum nice value for a process is 39 (2 * {NZERO} -1) and the minimum is 0 (zero). Requests for values outside these limits result in the nice value being set to the corresponding limit. [XPG4-UNIX] If execution of the Standard C Library nice() function fails, the system does not alter the specified priority. Any process can lower its priority (numerically raise its nice value). A process must have superuser privileges to raise its priority (numerically lower its nice value). [Tru64 UNIX] For backward compatibility, a version of the nice() function is supported that allows nice values in the range of -20 to 20. Requests for values above or below these limits result in the nice value being set to the corresponding limit. To use the backward-compat- ible version of nice(), compile with the Berkeley Compatibility Library (libbsd.a). RETURN VALUES
Upon successful completion, the nice() function returns the new nice value minus 20 ({NZERO}). Otherwise, the function returns -1 and sets errno to indicate the error. ERRORS
The Standard C Library version of nice() sets errno to the specified values for the following conditions: The calling process does not have appropriate privilege. [Tru64 UNIX] The libbsd.a version of nice() sets errno to the same values as the setpriority() function. For information about possible return values for the setpriority() function, see setpriority(2). RELATED INFORMATION
Functions: exec(2), getpriority(2), setpriority(2) Standards: standards(5) delim off nice(3)
All times are GMT -4. The time now is 12:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy