Sponsored Content
Top Forums Shell Programming and Scripting Reading multiple values from multiple lines and columns and setting them to unique variables. Post 302902966 by FMMOLA on Friday 23rd of May 2014 08:25:09 AM
Old 05-23-2014
Reading multiple values from multiple lines and columns and setting them to unique variables.

Hello,

I would like to ask for help with csh script.

An example of an input in .txt file is below, the number of lines varies from file to file and I have 2 or 3 columns with values. I would like to read all the values (probably one by one) and set them to independent unique variables that can be used later for mathematical operations or "cat" outputs. Is it possible to do it in C-shell? I would not like to change the shell because I want to add this part to my "value extraction" script which I made.

Thanks for the help.
Code:
125 143 19
149 153  5
216 224  9
226 247 22
250 254  5
255 275 21
290 292  3
296 302  7
306 323 18
326 339 14
348 371 24
378 406 29
410 414  5
415 423  9


Moderator's Comments:
Mod Comment Please use code tags next time for your code and data. Thanks

Last edited by FMMOLA; 05-23-2014 at 12:17 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk match multiple columns in multiple lines in single file

Hi, Input 7488 7389 chr1.fa chr1.fa 3546 9887 chr5.fa chr9.fa 7387 7898 chrX.fa chr3.fa 7488 7389 chr21.fa chr3.fa 7488 7389 chr1.fa chr1.fa 3546 9887 chr9.fa chr5.fa 7898 7387 chrX.fa chr3.fa Desired Output 7488 7389 chr1.fa chr1.fa 2 3546 9887 chr5.fa chr9.fa 2... (2 Replies)
Discussion started by: jacobs.smith
2 Replies

2. Programming

Reading multiple columns in C++

Dear all, I am novice in C+= programing. I would like to seek help in one of the progra. Here it is, I have txt file which has the data as following order varA varB -21 0 -21.2 3, 4, 5, 6 -21.4 45, 65, 87, 98, 98 -22.0 345677, 349887, 98766, 877654, 987543 -23.0 76549,... (17 Replies)
Discussion started by: emily
17 Replies

3. Shell Programming and Scripting

Reading multiple values in while loop

I'm having trouble with a simple piece of code. IFS=, echo "1,2,3,4,5,6,7,8" | while read x y do echo "x=$x" echo "y=$y" done I'm hoping for x=1 y=2 x=3 y=4 . . . but I'm getting x=1 (3 Replies)
Discussion started by: sabbata
3 Replies

4. Shell Programming and Scripting

Add unique header to multiple lines

I have a file of lines with the following format: AACCCGTAGATCCGAACTTGTG ACCCGTAGATCCGAACTTGTG CCGTAGATCCGAACTTGTG CGTAGATCCGAACTTGT I want to give a header to each line, using awk, where the header is equal to the line that follows, like this: >AACCCGTAGATCCGAACTTGTG ... (2 Replies)
Discussion started by: Palgrave
2 Replies

5. Shell Programming and Scripting

[Solved] Counting The Number of Lines Between Values with Multiple Variables

Hey everyone, I have a bunch of lines with values in field 4 that I am interested in. If these values are between 1 and 3 I want it to count all these values to all be counted together and then have the computer print out LOW and the number of lines with those values in between 1 and 3,... (2 Replies)
Discussion started by: VagabondGold
2 Replies

6. Shell Programming and Scripting

Read record from the text file contain multiple separated values & assign those values to variables

I have a file containing multiple values, some of them are pipe separated which are to be read as separate values and some of them are single value all are these need to store in variables. I need to read this file which is an input to my script Config.txt file name, first path, second... (7 Replies)
Discussion started by: ketanraut
7 Replies

7. Shell Programming and Scripting

Count Unique values from multiple lists of files

Looking for a little help here. I have 1000's of text files within a multiple folders. YYYY/ /MM /1000's Files Eg. 2014/01/1000 files 2014/02/1237 files 2014/03/1400 files There are folders for each year and each month, and within each monthly folder there are... (4 Replies)
Discussion started by: whegra
4 Replies

8. UNIX for Dummies Questions & Answers

Reading multiple variables in a loop

Hi, I managed to read and print variable as shown in the below code. table_name=table1,table2,table3 i=0 IFS="," for i in $table_name do echo $i done Is there a way how I can read more than one variable. For example I need to read 2 variables and populate the output... (6 Replies)
Discussion started by: shash
6 Replies

9. Shell Programming and Scripting

Removing carriage returns from multiple lines in multiple files of different number of columns

Hello Gurus, I have a multiple pipe separated files which have records going over multiple Lines. End of line separator is \n and records going over multiple lines have <CR> as separator. below is example from one file. 1|ABC DEF|100|10 2|PQ RS T|200|20 3| UVWXYZ|300|30 4| GHIJKL|400|40... (7 Replies)
Discussion started by: dJHa
7 Replies

10. UNIX for Beginners Questions & Answers

Split into multiple files by using Unique columns in a UNIX file

I have requirement to split below file (sample.csv) into multiple files by using the unique columns (first 3 are unique columns) sample.csv 123|22|56789|ABCDEF|12AB34|2019-07-10|2019-07-10|443.3400|1|1 123|12|5679|BCDEFG|34CD56|2019-07-10|2019-07-10|896.7200|1|2... (3 Replies)
Discussion started by: RVSP
3 Replies
iconv_pc_cyr(5)                                         Standards, Environments, and Macros                                        iconv_pc_cyr(5)

NAME
iconv_pc_cyr - code set conversion tables for Alternative PC Cyrillic DESCRIPTION
The following code set conversions are supported: +---------------------------------------------------------------------+ | Code Set Conversions Supported | +--------------+--------+--------------+--------+---------------------+ | Code |Symbol |Target Code |Symbol | Target Output | +--------------+--------+--------------+--------+---------------------+ |PC Cyrillic |alt |ISO 8859-5 |iso5 | ISO 8859-5 Cyrillic | +--------------+--------+--------------+--------+---------------------+ |PC Cyrillic |alt |KOI8-R |koi8 | KOI8-R | +--------------+--------+--------------+--------+---------------------+ |PC Cyrillic |alt |MS 1251 |win5 | Windows Cyrillic | +--------------+--------+--------------+--------+---------------------+ |PC Cyrillic |alt |Mac Cyrillic |mac | Macintosh Cyrillic | +--------------+--------+--------------+--------+---------------------+ CONVERSIONS
The conversions are performed according to the following tables. All values in the tables are given in octal. PC Cyrillic to ISO 8859-5 For the conversion of PC Cyrillic to ISO 8859-5, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | PC Cyrillic | ISO 8859-5 | PC Cyrillic | ISO 8859-5 | |24 | 4 |231 |311 | |200 | 260 |232 |312 | |201 | 261 |233 |313 | |202 | 262 |234 |314 | |203 | 263 |235 |315 | |204 | 264 |236 |316 | |205 | 265 |237 |317 | |206 | 266 |240 |320 | |207 | 267 |241 |321 | |210 | 270 |242 |322 | |211 | 271 |243 |323 | |212 | 272 |244 |324 | |213 | 273 |245 |325 | |214 | 274 |246 |326 | |215 | 275 |247 |327 | |216 | 276 |250 |330 | |217 | 277 |251 |331 | |220 | 300 |252 |332 | |221 | 301 |253 |333 | |222 | 302 |254 |334 | |223 | 303 |255 |335 | |224 | 304 |256 |336 | |225 | 305 |257 |337 | |226 | 306 |260-337 |255 | |227 | 307 |360 |241 | |230 | 310 |362-376 |255 | +---------------+----------------+----------------+---------------+ PC Cyrillic to KOI8-R For the conversion of PC Cyrillic to KOI8-R, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | PC Cyrillic | KOI8-R | PC Cyrillic | KOI8-R | |24 | 4 |242 |327 | |200 | 341 |243 |307 | |201 | 342 |244 |304 | |202 | 367 |245 |305 | |203 | 347 |246 |326 | |204 | 344 |247 |332 | |205 | 345 |250 |311 | |206 | 366 |251 |312 | |207 | 372 |252 |313 | |210 | 351 |253 |314 | |211 | 352 |254 |315 | |212 | 353 |255 |316 | |213 | 354 |256 |317 | |214 | 355 |257 |320 | |215 | 356 |260-337 |255 | |216 | 357 |340 |322 | |217 | 360 |341 |323 | |220 | 362 |342 |324 | |221 | 363 |343 |325 | |222 | 364 |344 |306 | |223 | 365 |345 |310 | |224 | 346 |346 |303 | |225 | 350 |347 |336 | |226 | 343 |350 |333 | |227 | 376 |351 |335 | |230 | 373 |352 |337 | |231 | 375 |353 |331 | |232 | 377 |354 |330 | |233 | 371 |355 |334 | |234 | 370 |356 |300 | |235 | 374 |357 |321 | |236 | 340 |360 |263 | |237 | 361 |361 |243 | |240 | 301 |362-376 |255 | |241 | 302 | | | +---------------+----------------+----------------+---------------+ PC Cyrillic to MS 1251 For the conversion of PC Cyrillic to MS 1251, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | PC Cyrillic | MS 1251 | PC Cyrillic | MS 1251 | |24 | 4 |242 |342 | |200 | 300 |243 |343 | |201 | 301 |244 |344 | |202 | 302 |245 |345 | |203 | 303 |246 |346 | |204 | 304 |247 |347 | |205 | 305 |250 |350 | |206 | 306 |251 |351 | |207 | 307 |252 |352 | |210 | 310 |253 |353 | |211 | 311 |254 |354 | |212 | 312 |255 |355 | |213 | 313 |256 |356 | |214 | 314 |257 |357 | |215 | 315 |260-337 |210 | |216 | 316 |340 |360 | |217 | 317 |341 |361 | |220 | 320 |342 |362 | |221 | 321 |343 |363 | |222 | 322 |344 |364 | |223 | 323 |345 |365 | |224 | 324 |346 |366 | |225 | 325 |347 |367 | |226 | 326 |350 |370 | |227 | 327 |351 |371 | |230 | 330 |352 |372 | |231 | 331 |353 |373 | |232 | 332 |354 |374 | |233 | 333 |355 |375 | |234 | 334 |356 |376 | |235 | 335 |357 |377 | |236 | 336 |360 |250 | |237 | 337 |361 |270 | |240 | 340 |362-376 |210 | |241 | 341 | | | +---------------+----------------+----------------+---------------+ PC Cyrillic to Mac Cyrillic For the conversion of PC Cyrillic to Mac Cyrillic, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | PC Cyrillic | Mac Cyrillic | PC Cyrillic | Mac Cyrillic | |24 | 4 |341 |361 | |240 | 340 |342 |362 | |241 | 341 |343 |363 | |242 | 342 |344 |364 | |243 | 343 |345 |365 | |244 | 344 |346 |366 | |245 | 345 |347 |367 | |246 | 346 |350 |370 | |247 | 347 |351 |371 | |250 | 350 |352 |372 | |251 | 351 |353 |373 | |252 | 352 |354 |374 | |253 | 353 |355 |375 | |254 | 354 |356 |376 | |255 | 355 |357 |337 | |256 | 356 |360 |335 | |257 | 357 |361 |336 | |260-337 | 40 |362-376 |40 | |340 | 360 | | | +---------------+----------------+----------------+---------------+ FILES
/usr/lib/iconv/*.so conversion modules /usr/lib/iconv/*.t conversion tables /usr/lib/iconv/iconv_data list of conversions supported by conversion tables SEE ALSO
iconv(1), iconv(3C), iconv(5) SunOS 5.10 18 Apr 1997 iconv_pc_cyr(5)
All times are GMT -4. The time now is 07:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy