Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Simplest way to format with If on stout? Post 302555347 by Corona688 on Wednesday 14th of September 2011 01:23:04 PM
Old 09-14-2011
true is an integer, 1. "true" is a string.

So command | awk '{if($0 == "true") print "\033[1;32m" $0; else print "\033[1;31m" $0}'
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

the simplest question in the WORLD

how do i get unix on my windows 95 computer? (3 Replies)
Discussion started by: killfry
3 Replies

2. UNIX for Dummies Questions & Answers

I'm incapable of the simplest thing

Okay, stupid question How can I use ed, exactly? I need just a quick tutorial, thanks. Cheers! Tavy (2 Replies)
Discussion started by: Tavy
2 Replies

3. UNIX for Dummies Questions & Answers

How can I find files by date or size from stout?

Hello all I wander if I make for example " ls -l " And it gives me all the files in the directory with the additional info like data size and privileges But what if I like to filter the stout result for example by date When I try to do: echo "`ls -l`" | grep "Jan 12" it gives me the... (2 Replies)
Discussion started by: umen
2 Replies

4. Shell Programming and Scripting

Retaining the Unix CSV format in Excel format while exporting

Hi All, I have created a Unix Shell script whch creates a *.csv file and export it to Excel. The problem i am facing is that Users wants one of the AMOUNT field in comma separted values. Example : if the Amount has the value as 3000000 User wants to be in 3,000,000 format. This Amount format... (2 Replies)
Discussion started by: rawat_me01
2 Replies

5. Shell Programming and Scripting

stout, stderr to syslog via function with if statement

I have a function called sysLogger in a bash script that I am using to redirect stdout and stderr to syslog. Part of the script contains an option to turn on debugging otherwise I want debugging output to go to /dev/null. I am struggling to understand how to make this work using the function... (10 Replies)
Discussion started by: jelloir
10 Replies

6. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

7. UNIX for Dummies Questions & Answers

Should be the simplest thing in the world grep

should be the simplest thing in the world use grep but i not get it i have several files, in this files i need to khow how many times the words are repeated but the files must star whit P_ this work egrep -c "word1|word2" *P_* result: P_11351814:1 P_11351823:3 P_11351826:1... (2 Replies)
Discussion started by: SirGrifo
2 Replies

8. Programming

The simplest network driver

Hi, I am trying to write the simplest network driver that would send whatever through cable. My configuration is: Linux machine with some Intel network adapter Another machine with WireShark I connected Intel network adapter to second machine and want anything to pop up at wireshark. ... (12 Replies)
Discussion started by: Chrisdot
12 Replies

9. Shell Programming and Scripting

Need script for transferring bulk files from one format to text format

"Help Me" Need script for transferring bulk files from one format to text format in a unix server. Please suggest (2 Replies)
Discussion started by: Kranthi Kumar
2 Replies

10. UNIX for Dummies Questions & Answers

Simplest way to access Linux system mail from email client

I'm not a Linux newbie but this seemed like a pretty n00b question. I am familiar with Postfix/Dovecot setups but now I am looking for the simplest way to access mail on a Linux system, such as the mail that goes to /var/mail/root. I know I can edit /etc/aliases and have the system mail go straight... (6 Replies)
Discussion started by: TayKimchi
6 Replies
TEST(1) 						      General Commands Manual							   TEST(1)

NAME
test - condition command SYNOPSIS
test expr DESCRIPTION
test evaluates the expression expr, and if its value is true then returns zero exit status; otherwise, a non zero exit status is returned. test returns a non zero exit if there are no arguments. The following primitives are used to construct expr. -r file true if the file exists and is readable. -w file true if the file exists and is writable. -f file true if the file exists and is not a directory. -d file true if the file exists and is a directory. -s file true if the file exists and has a size greater than zero. -t [ fildes ] true if the open file whose file descriptor number is fildes (1 by default) is associated with a terminal device. -z s1 true if the length of string s1 is zero. -n s1 true if the length of the string s1 is nonzero. s1 = s2 true if the strings s1 and s2 are equal. s1 != s2 true if the strings s1 and s2 are not equal. s1 true if s1 is not the null string. n1 -eq n2 true if the integers n1 and n2 are algebraically equal. Any of the comparisons -ne, -gt, -ge, -lt, or -le may be used in place of -eq. These primaries may be combined with the following operators: ! unary negation operator -a binary and operator -o binary or operator ( expr ) parentheses for grouping. -a has higher precedence than -o. Notice that all the operators and flags are separate arguments to test. Notice also that parentheses are meaningful to the Shell and must be escaped. SEE ALSO
sh(1), find(1) TEST(1)
All times are GMT -4. The time now is 04:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy