Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Strings with Special chars in IF condition Post 302401468 by hooaamai on Saturday 6th of March 2010 08:26:24 AM
Old 03-06-2010
Yes. It's working if i remove the quotes. Thank you.

Additionally, I had to redirect the err out of if statement to /dev/null.


But, if I get the same value in the variable for another command, then how can i convert the variable "fax" into a string variable??


Code:
 
#!/bin/ksh
fax= `grep abcd file1.dat | cut -c1-12 `

if [  -z  ${fax} ]; then
        fax_no="000-000-0000"
else
        fax_no=$fax
fi
echo $fax_no

Lets assume that "grep abcd file1.dat | cut -c1-12" returns the value "123-456-7890". The code is not working in this case.

Last edited by hooaamai; 03-06-2010 at 09:27 AM.. Reason: wrong formatting
hooaamai
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Supress special chars in vi

Hi, One of our application is producing log files. But if we open the log file in vi or less or view mode, it shows all the special characters in it. The 'cat' shows correctly but it shows only last page. If I do 'cat' <file_name> | more, then again it shows special characters. ... (1 Reply)
Discussion started by: divakarp
1 Replies

2. Shell Programming and Scripting

treating special chars

Hi, I need some advise on treating non printable chars over ascii value 126 Case 1 : On some fields in the text , I need to retiain then 'as-is' and load to a database.I understand it also depends on database codepage. but i just wanna know how do i ensure it do not change while loading... (1 Reply)
Discussion started by: braindrain
1 Replies

3. Shell Programming and Scripting

special chars arrangement in code

here is my simple script to show process and owners except me: ps `-ef |grep xterm |grep -v aucar` | while read a1 a2 a3 a4 a5 a6 a7 a8 do echo KILL..\($a1\).. $a2 |more done how can I pass values from command "ps -ef |grep xterm|grep -v aucar" to ? because above command... (2 Replies)
Discussion started by: xramm
2 Replies

4. Shell Programming and Scripting

Special chars in sed variable

Hi, For years ive been using this script to do mass search & replaces on our websites. Its worked with all sorts of spaces, quotes, html or whatever with a little adjusting here and there. But I just cant get this pattern to work: #!/bin/bash OLDURL="document.write('<script... (2 Replies)
Discussion started by: mutex
2 Replies

5. Shell Programming and Scripting

print all between patterns with special chars

Hi, I'm having trouble with awk print all characters between 2 patterns. I tried more then one solution found on this forum but with no success. Probably my mistakes are due to the special characters "" and "]"in the search patterns. Well, have a log file like this: logfile.txt ... (3 Replies)
Discussion started by: ginolatino
3 Replies

6. Shell Programming and Scripting

All strings within two special chars

I have a file with multiple lines. From each line I want to get all strings that starts with '+' and ends with '/'. Then I want the strings to be separated by ' + ' Example input: +$A$/NOUN+At/NSUFF_FEM_PL+K/CASE_INDEF_ACC Sample output: $A$ + At + K (20 Replies)
Discussion started by: Viernes
20 Replies

7. Shell Programming and Scripting

If condition matching with special chars

Hi, I have file #cat drivers.txt fcs0 fcs1 vscsi1 vscsi2 In this i need to check the availabality of "fcs" or "vscsi" alone not vscsi0,fcs1 I tried with "if condition" but it is not working. cat drivers.txt| while read ADAP do echo "Checking for $ADAP" if ;then echo "FC... (9 Replies)
Discussion started by: ksgnathan
9 Replies

8. UNIX for Dummies Questions & Answers

How to search for a string with special chars?

Hi guys, I am trying to find the following string in a file, but I always get pattern not found error, not sure what is missing here. Can you help please? I do a less to open the xrates.log and then do a /'="18"' in the file and tried various combinations to search the below string. String... (8 Replies)
Discussion started by: santokal
8 Replies

9. Shell Programming and Scripting

Safely Remove Files with Special Chars

Hey Guys, I'm swamped writing code for the forums: Could someone write a script or command line to safely delete files with special chars in filenames from a directory: Example: -rw-r--r-- 1 root root 148 Apr 30 23:00 ?xA?? -rw-r--r-- 1 root root 148... (8 Replies)
Discussion started by: Neo
8 Replies

10. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies
g3topbm(1)						      General Commands Manual							g3topbm(1)

NAME
g3topbm - convert a Group 3 fax file into a portable bitmap SYNOPSIS
g3topbm [-kludge] [-reversebits] [-stretch] [g3file] DESCRIPTION
Reads a Group 3 fax file as input. Produces a portable bitmap as output. OPTIONS
-kludge Tells g3topbm to ignore the first few lines of the file; sometimes fax files have some junk at the beginning. -reversebits Tells g3topbm to interpret bits least-significant first, instead of the default most-significant first. Apparently some fax modems do it one way and others do it the other way. If you get a whole bunch of "bad code word" messages, try using this flag. -stretch Tells g3topbm to stretch the image vertically by duplicating each row. This is for the low-quality transmission mode. All flags can be abbreviated to their shortest unique prefix. REFERENCES
The standard for Group 3 fax is defined in CCITT Recommendation T.4. BUGS
Probably. SEE ALSO
pbmtog3(1), pbm(5) AUTHOR
Copyright (C) 1989 by Paul Haeberli <paul@manray.sgi.com>. 02 October 1989 g3topbm(1)
All times are GMT -4. The time now is 05:24 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy