06-09-2005
Ah..
I took yours and made a couple of adjustments..
I forgot that this specific field, even when blank, still contains quotation marks at both ends, the first char and last char.. I adjusted the regex in this way.
$2 ~ /^["][ ]+["]$/
1. First and last char must be a quotation.
2. One or more spaces much match in between.
This tells me if a field is blank/has no value (assuming there will always be quotes at either end).
Ah, I posted after you did, your regex looks better than mine.
Thanks. I like the * idea better since, perhaps, there may come a time when there will be no spaces in between the quotes.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have the following data in the format as shown (note: there are more than 1 blank spaces between each field and the spaces are not uniform, meaning there can be one blank space between field1 and field2 and 3 spaces between field3 and field4, in this example, # are the spaces in between... (19 Replies)
Discussion started by: ReV
19 Replies
2. Shell Programming and Scripting
Hello,
I have a record which split with "," I would like to check..if the field is empty and it will field "NIL" into the field.
input
45111,40404,peter,,0303403,0,030304,john,,9,0,
output
45111,40404,peter,NIL,0303403,0,030304,john,NIL,9,0, (8 Replies)
Discussion started by: happyv
8 Replies
3. Shell Programming and Scripting
Hi,
I tried the below piece of code for my script to check whether it has a blank space for a particular field.
if(f10==/]/){
print "Field 10 is Correct";}
else{
print "Field 10 is Wrong"; }
Please help me to know whether the "if" condition applied here is correct or do i... (14 Replies)
Discussion started by: meva
14 Replies
4. Shell Programming and Scripting
Hi Everyone,
1.txt
a;1234;134;1111111
b;123;123;1111111
c;123;1334;1111111
d;1234;1234;1111111
output
a;1234;134;1111111
c;123;1334;1111111
d;1234;1234;1111111
if field2 legth>3 or field3 length >3, then output. Please advice.
Thanks (4 Replies)
Discussion started by: jimmy_y
4 Replies
5. Shell Programming and Scripting
Hi all,
I have a huge file and I need to get ride of the fields 6-11 and replace the blanks in field 5 with a missing value(99999).
159,93848,5354,343,67898,45,677,5443,434,5545,45
677,45545,3522,244,
554,54344,3342,456,
344,43443,2344,444,23477... (12 Replies)
Discussion started by: GoldenFire
12 Replies
6. Shell Programming and Scripting
Hi everyone..
I'm trying to eliminate multiple whitespaces from a file..
I must make use of shell script to eliminate whitespaces..
Take a look at the sample file
1 int main()
2 {
3 int a,b;
4 printf("Enter the values of a and b");
5 scanf("%d%d",&a,&b);
6 if(a>b) ... (6 Replies)
Discussion started by: abk07
6 Replies
7. Shell Programming and Scripting
I have this
text.filecharles darwin sam delight
george washington johnson culper
darwin sam delight
micheal jackson penny lite and would like to remove the row, if the first field is blank. so the result would be:
result.filecharles darwin sam ... (4 Replies)
Discussion started by: charles33
4 Replies
8. Shell Programming and Scripting
Hi,
I have the following file, I'd like to add an additional blank field to this file
This is a tab delimited file, I have tried the same thing on excel, but looking for a unix solution.
Here is my input:
Country Postal Admin4 StreetBaseName StreetType
HUN 2243 Kóka Dózsa György ... (3 Replies)
Discussion started by: ramky79
3 Replies
9. Shell Programming and Scripting
Find a blank field
Hi
I have set of fields that have some blank values, how to find that and get its line noumbers in output file.
Ex:
Col1 col2 col3
11 ss 103
12 104
13 105
14 se 106 (2 Replies)
Discussion started by: Shenbaga.d
2 Replies
10. Shell Programming and Scripting
Hi All
Need Help
I have a file with the below format (ABC.TXT) :
®¿¿ABCDHEJJSJJ|XCBJSKK01|M|7348974982790
HDFLJDKJSKJ|KJALKSD02|M|7378439274898
KJHSAJKHHJJ|LJDSAJKK03|F|9898982039999
(cont......)
I need to write a script where it will check for : blank lines (between rows,before... (6 Replies)
Discussion started by: chatwithsaurav
6 Replies