473,320 Members | 1,732 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Linux - How to call lines from a file in a for loop???

Hi,

I am new to Linux and am trying to pull several lines from one file to modify them.

I have written a file table.txt...

Expand|Select|Wrap|Line Numbers
  1. [lg45@dev64-mgmt ~]$ cat table.txt
  2.  
  3. Angiogenin 10 25793633 25815393
  4. Alpha-actinin 28 7893500 7941168
I want to pull out column 3 of each line and loop through them all adding 500,000bp.

I know that i can use awk to call...

Expand|Select|Wrap|Line Numbers
  1. [lg45@dev64-mgmt ~]$ awk '{print$3'} table.txt
I am looking for suggestions on how i can modify the following to add an awk statement that pulls out each column but still allows me to loop?

Expand|Select|Wrap|Line Numbers
  1. [lg45@dev64-mgmt ~]$ for i in `cat table.txt`; do echo $i; done
Thanks :)
lesley
Jun 21 '10 #1
2 1852
Expand|Select|Wrap|Line Numbers
  1. while read line
  2. do
  3.   /*your code*/
  4. done < table.txt
  5.  
Jun 23 '10 #2
Hydaral
24
I don't quite understand what you want to accomplish, do you want to add 500000 to the number in the third column, or append the string "500,000bp" to it?

Perhaps you could give an example of the expected output.

If you just want to operate on the third column, then you don't need any loops.
Jun 25 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Bob Helber | last post by:
I've got a perl script with a system command, within a for loop, that calls a FORTRAN program. For one of the iterations of the for loop the FORTRAN program quits with an error due to bad input. ...
1
by: ASH | last post by:
Hello all, I'm using the "API: Call Windows File Open/Save Dialog Box" to source the name of a file to open. The Dialog Box when called opens in the top left hand corner of the screen. I have...
0
by: New comer | last post by:
Hi I'd like to know how to use c# form to call excel file. Like when I click a button, the .xls file opened, and some data in the textboxes put into the excel cells. Thanks
2
by: Naraht | last post by:
I'm looking for information on getting the Version of a Windows Executable (or DLL) *after* the file has been copied to a Linux system. This probably means I will need to recreate...
6
by: rony_16 | last post by:
Hi, Does any one know how to call .net file aspx and pass him a parameters , and get and answer ? Regards,Rony
2
by: JackInDaBox | last post by:
Hello, I am trying to run all SQL scripts (with no params) in the same folder as the batch file is. I have not done much with batch files before but I think I have gotten close. It seems to work if...
1
by: tsunethere | last post by:
hi if anybody knows plz tell me How to call cgi file on button`s onClick event? I declared like <INPUT TYPE="submit" value="submit" onClick="ex1.cgi"> but not working. wat I need to do?? ...
1
by: Paresh Mahajan | last post by:
Hi All, I need to call (run/execute) sample.sh file from the windows perl file. I know in linux it can be called as `sample.sh`; but that is not working in window XP. Here my Sample.sh is...
1
by: JeanDean | last post by:
I have successfully installed the valgrind-3.2.3 but it is resulting in following error ------------------------- valgrind ls -l valgrind: failed to start tool 'memcheck' for platform...
3
by: hpandya | last post by:
Can i call php file in Javascript file,? or how can call php functions in javascript file ? Please help me out here Thanks, Harsh
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.