Sponsored Content
Full Discussion: reduce the or conditions
Top Forums Shell Programming and Scripting reduce the or conditions Post 302116230 by kahuna on Wednesday 2nd of May 2007 12:38:17 PM
Old 05-02-2007
Quote:
Originally Posted by hitmansilentass
there are too many 'or' (||) conditions which i want to reduce so that it looks better
It's not clear what you mean by "looks better". Exactly what would "look better" look like? Assuming your variables do not contain whitespace, another alternative without || might be
Code:
if [[ `echo $XXXX $YYYYY $TTTT $NNNN $QQQQ |wc -w` -ne 5 ]]; then
whatever
fi

 

10 More Discussions You Might Find Interesting

1. AIX

reduce available ram

hello, we have a aix 5.2 server with 8GB of ram. is it possible, without actually removing the hardware, to have the O/S think it has only 4GB of ram? We would like to see how the handles and responds if it only had 4Gb instead of the 8GB. Any ideas or suggestions? Thanks Looks like i found... (6 Replies)
Discussion started by: zuessh
6 Replies

2. UNIX for Dummies Questions & Answers

Can I reduce sysdump?

Hi, I have a server which is running out of space on the rootvg. When trying to find some spare space I discovered there are 2 sysdump logical volumes, each of 5GB, yet if I get an estimate of the dump size it's only 0.5 GB. $ lsvg -l rootvg|grep sysdump hd71 sysdump 20 ... (1 Reply)
Discussion started by: m223464
1 Replies

3. Shell Programming and Scripting

To reduce execution time

Hi All, The below script I run daily and it consumes 2 hours approx. In this I am calling another script and executing the same twice. Is the loop below the cause for the slow process?Is it possible to finetune the program so that it runs in a much faster way? The first script: #!/bin/ksh... (4 Replies)
Discussion started by: Sreejith_VK
4 Replies

4. Shell Programming and Scripting

reduce a string

hi i have a string "hostname=lpdma520_dev_ipc_us_aexp_com" now i need only "newHostname=lpdma520" how to do this one please help soon (2 Replies)
Discussion started by: satish@123
2 Replies

5. AIX

reduce used paging space

Hi I have used gzip on AIX and the used paging space has jumped from 7% to 20%. The gzip process is finished since a long time. But the used paging space is still the same. How to release this space ? (1 Reply)
Discussion started by: bfarah
1 Replies

6. Shell Programming and Scripting

Reduce

printf "\nClosing stats:\n" >> data.txt echo >> data.txt sed 's/^ \t*//;/^#/d;/^$/d' $stats | while read line do close=$(grep -w "^$line" $datafile | sed -e 's/\(.*\),\(.*\),\(.*\)/\2/') if ; then printf "%5d. %-s was not found in file\n"... (3 Replies)
Discussion started by: jafa401
3 Replies

7. Shell Programming and Scripting

How to reduce code.....

Hi All, Could some one help me to reduce the code... if then ./plist -m "$queuename" |grep $2|awk '{print $3}' >unlock.log elif then ./plist -m "$queuename" |grep $2|awk '{print $4}' >unlock.log else ./plist -m "$queuename" |grep $2|awk '{print $5}' >unlock.log . . . . ... (1 Reply)
Discussion started by: harshakusam
1 Replies

8. Shell Programming and Scripting

Errors in if conditions with to many OR conditions

Hi ALL I have a script where in i need to check for several values in if conditons but when i execute the script it throws error such as "TOO MANY ARGUMENTS" if then msg="BM VAR Issue :: bmaRequestVAR=$bmaRequestVAR , nltBMVAR=$nltBMVAR , bmaResponseVAR=$bmaResponseVAR ,... (10 Replies)
Discussion started by: nikhil jain
10 Replies

9. Shell Programming and Scripting

Help to reduce time of archiving

hi all, i have written the following script that does this work: 1. copy large logs files from one server to another. 2. then unzip this files and extraxt from these large https logs only those fields that are neccesary. 3. then archive the extracted logs to new files. BUT the problem is... (7 Replies)
Discussion started by: arrals_vl
7 Replies

10. Shell Programming and Scripting

Reduce the space every four hours

Hi Team, Please help me in shell script, I have a some file in Linux which I want to reduce the space every 4 hours in the form of ZIP move to other location with the help of Shell Script using with with current date. Can you please help me. Regards, Suhail (3 Replies)
Discussion started by: frsuhail001
3 Replies
fold(1) 						      General Commands Manual							   fold(1)

NAME
fold - Breaks or wraps lines in a file SYNOPSIS
fold [-bs] [-w width | -width] [file...] The fold command wraps lines in the specified files. If a file is not specified, standard input is the default. All lines are wrapped to meet the maximum width specified. STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: fold: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Specifies that width be counted in bytes rather than in column positions. Using the -b option does not limit lines to LINE_MAX bytes. Breaks (or wraps) a line if a segment of the line contains a blank character in the first width column position (or bytes). This enables the line to meet width constraints. If a blank character is not in the correct width column position, the -s option has no affect on that input line. Specifies the maximum width to use when lines are wrapped in column positions (or bytes if the -b option is specified). Either -w width or -width is acceptable input where width is the number of column positions (or bytes). The default value is 80. DESCRIPTION
The fold command is a filter that wraps lines from the specified input files or standard input to a maximum of width (or bytes, if the -b option is specified). The fold command wraps lines by inserting a newline character into the output so that each output line is the maxi- mum column positions or bytes specified. A line cannot be broken in the middle of a character. The fold command is often used to send text files to line printers that truncate, rather than wrap, lines wider than the printer is able to print (usually 80 or 132 column positions). If the <backspace>, <tab>, or <carriage return> characters are encountered in the input, and the -b option is not specified, these charac- ters are treated specially: The current count of line width is decremented by one, although the count never becomes negative. The fold command does not insert a newline character immediately before or after any backspace character. Each tab character encountered advances the column position pointer to the position of the next tab stop. Tab stops are at each column position number, such that number modulo 8 equals 1. The current count of the line width is set to zero (0). The fold command does not insert a newline immediately before or after any carriage return. [Tru64 UNIX] The fold command possibly affects underlining in a file. EXIT STATUS
The fold command returns the following values: All input files were successfully processed. [Tru64 UNIX] A usage error occurred. [Tru64 UNIX] An input file cannot be opened. The fold command continues processing the other input files specified on the command line. EXAMPLES
The fold command can be used to prepare files to be joined side-by-side with the paste command. For example, the contents of two files, az and AZ follows: aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn oooo pppp qqqq rrrr ssss tttt uuuu vvvv wwww xxxx yyyy zzzz AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO PPPP QQQQ RRRR SSSS TTTT UUUU VVVV WWWW XXXX YYYY ZZZZ To display the az and AZ files side-by-side, use the following command line: fold -w 32 az > az2; fold -w 32 AZ > AZ2; paste -d" " az2 AZ2 Executing the previous command line results in the following output: aaaa bbbb cccc dddd eeee ffff gg AAAA BBBB CCCC DDDD EEEE FFFF GG gg hhhh iiii jjjj kkkk llll mmmm GG HHHH IIII JJJJ KKKK LLLL MMMM nnnn oooo pppp qqqq rrrr ssss tt NNNN OOOO PPPP QQQQ RRRR SSSS TT tt uuuu vvvv wwww xxxx yyyy zzzz TT UUUU VVVV WWWW XXXX YYYY ZZZZ ENVIRONMENT VARIABLES
The following environment variables affect the execution of fold: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari- ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments) and for the determination of the width in column positions each character would occupy on a constant-width font output device. Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MES- SAGES. SEE ALSO
Commands: cut(1), expand(1), paste(1) Standards: standards(5) fold(1)
All times are GMT -4. The time now is 11:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy