473,403 Members | 2,359 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,403 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 1856
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.