File with 3 columns


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting File with 3 columns
# 1  
Old 05-06-2016
File with 3 columns

friends

I have a file that process but before doing anything asegurqarme I have only 3 columns as puedop make that validation with awk or some other function.


example

Code:
1;100;500
101;800;600
801;900;700

# 2  
Old 05-06-2016
I am unable to find the terms "asegurqarme" and "puedop" in any of my dictionaries. Please restate your problem clearly in English with sample input, sample output, and describe the logic used to guide the actions of the script you want to produce.

Also, please tell us what operating system and shell you are using, and show us what code you have tried to solve this problem on your own.
# 3  
Old 05-06-2016
Quote:
Originally Posted by tricampeon81
friends

I have a file that process but before doing anything asegurqarme I have only 3 columns as puedop make that validation with awk or some other function.


example

Code:
1;100;500
101;800;600
801;900;700

It all depends of what your intentions are for validation. Is it per line? Is it as per file as a whole?
Also, what action would you like to take if the validation is successful or unsuccessful.

For example: you can display lines that have only three columns.
Code:
awk -F";" 'NF==3' tricampeon81.file

Any line that contains less or more than three fields (columns) will not be displayed.

Last edited by Aia; 05-06-2016 at 08:23 PM..
# 4  
Old 05-09-2016
if all three field needed to run a process then try some script like:
Code:
while IFS=";" read a b c
do
   [[ -n "$a" ]] && [[ -n "$b" ]] && [[ -n "$c" ]] && {
      echo processing record: "$a;$b;$c"
      #... do something else
   }
done < infile

This User Gave Thanks to rdrtx1 For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Compare two columns of one file to two columns in another file

I Have two files as below, first file: Start State |Next State |Session Count |Transition% LA_product_view |home |694 |28.660% LA_product_view | searchresults |54 |2.230% home | 1101260 | 2 | 0.050% second file: Start State Next State Session Count Transition% ... (7 Replies)
Discussion started by: Raghuram717
7 Replies

2. Shell Programming and Scripting

Match Columns in one file and extract columns from another file

Kindly help merging information from two files with the following data structure. I want to match for the CHR-SNP in Foo and get the columns that match from CHROM-rsID Fields 1 & 2 of foo may have duplicates, however, a joint key of Fields $1$2$3$4 is unique. Also would be helpful to clean up... (4 Replies)
Discussion started by: genehunter
4 Replies

3. Shell Programming and Scripting

Replacing 12 columns of one file by second file based on mapping in third file

i have a real data prod file with 80+ fields containing 1k -2k records. i have to extract say 12 columns out of this which are sensitive fields along with one primary key say SEQ_ID (like DOB,account no, name, SEQ_ID, govtid etc) in a lookup file. i have to replace these sensitive fields in... (11 Replies)
Discussion started by: megh12
11 Replies

4. Shell Programming and Scripting

How to concatenate 2-columns by 2 -columns for a text file?

Hello, I want to concatenate 2-columns by 2-columns separated by colon. How can I do so? For example, I have a text file containing 6 columns separated by tab. I want to concatenate column 1 and 2; column 3 and 4; column 5 and 6, respectively, and put a colon in between. input file: 1 0 0 1... (10 Replies)
Discussion started by: huiyee1
10 Replies

5. Shell Programming and Scripting

Columns vs. columns in same file

I'm trying to consolidate the below given input ID TIMEFRAME 193 18:30:0:390 177 18:30:0:605 180 18:30:0:710 215 18:30:0:690 165 18:30:0:580 195 18:30:0:170 252 18:30:0:185 198 18:30:0:265 246 18:30:0:370 183 18:30:0:330 225 18:30:0:110 173 18:30:0:220 66 18:30:0:790 248... (1 Reply)
Discussion started by: busyboy
1 Replies

6. Shell Programming and Scripting

Deleting all the fields(columns) from a .csv file if all rows in that columns are blanks

Hi Friends, I have come across some files where some of the columns don not have data. Key, Data1,Data2,Data3,Data4,Data5 A,5,6,,10,, A,3,4,,3,, B,1,,4,5,, B,2,,3,4,, If we see the above data on Data5 column do not have any row got filled. So remove only that column(Here Data5) and... (4 Replies)
Discussion started by: ks_reddy
4 Replies

7. UNIX for Advanced & Expert Users

Help in Deleting columns and Renaming Mutliple columns in a .Csv File

Hi All, i have a .Csv file in the below format startTime, endTime, delta, gName, rName, rNumber, m2239max, m2239min, m2239avg, m100016509avg, m100019240max, metric3min, m100019240avg, propValues 11-Mar-2012 00:00:00, 11-Mar-2012 00:05:00, 300.0, vma3550a, a-1_CPU Index<1>, 200237463, 0.0,... (9 Replies)
Discussion started by: mahi_mayu069
9 Replies

8. UNIX for Dummies Questions & Answers

Removing columns from a text file that do not have any values in second and third columns

I have a text file that has three columns. But at the end of the text file, there are trailing lines that have missing second and third columns: 4 0.04972604 KLHL28 4 0.0497332 CSTB 4 0.04979822 AIF1 4 0.04983331 DECR2 4 0.04990344 KATNB1 4 4 4 4 How can I remove the trailing... (3 Replies)
Discussion started by: evelibertine
3 Replies

9. Shell Programming and Scripting

Replace specific columns in one file with columns in another file

HELLO! This is my first post here! By the way, I think it is great that people do this. My question: I have two files, one is a .dilm and one is a .txt. It is my understanding that the .dilm file can be treated as a .txt file. I wrote another program where I was able to manipulate it as if it... (3 Replies)
Discussion started by: mehdib
3 Replies

10. Shell Programming and Scripting

Sum of three columns - in 4N columns file

Hi All, happy new year. I have a file with 4xN columns like 0.0000e+00 0.0000e+00 7.199E+07 7.123E+07 6.976E+07 6.482E+07 5.256E+07 2.523E+07 0.0000e+00 0.0000e+00 8.641E+07 8.550E+07 8.373E+07 7.780E+07 6.309E+07 3.028E+07... (8 Replies)
Discussion started by: f_o_555
8 Replies
Login or Register to Ask a Question