awk modifying entries on 2 lines at 2 positions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting awk modifying entries on 2 lines at 2 positions
# 1  
Old 03-14-2009
awk modifying entries on 2 lines at 2 positions

Hi
this script adds text in the correct place on one line only, in a script.
awk 'BEGIN{
printf "Enter residue and chain information: "
getline var < "-"
split(var,a)
}
/-s rec:/{$7=a[1]; }

{print}' FLXDOCK

but I need the same info added at position 7 on line 34 and position 5 on line 24.

This whole file needs directing to a newfile.

Will someone help pls?
# 2  
Old 03-14-2009
Quote:
but I need the same info added at position 7 on line 34 and position 5 on line 24.

Code:
NR == 24 { $5 = a[1] }
NR == 34 { $7 = a[1] }

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Replacing certain positions in lines with spaces

Hello, I have a file with hundreds of lines. Now I need to replace positions 750-766 in each line (whatever there is there) with spaces... how can I do that? Which command to use? The result will be all the lines in the file will have spaces in positions 750-766. Thanks! (3 Replies)
Discussion started by: netrom
3 Replies

2. Shell Programming and Scripting

Filter lines based on values at specific positions

hi. I have a Fixed Length text file as input where the character positions 4-5(two character positions starting from 4th position) indicates the LOB indicator. The file structure is something like below: 10126Apple DrinkOmaha 10231Milkshake New Jersey 103 Billabong Illinois ... (6 Replies)
Discussion started by: kumarjt
6 Replies

3. Shell Programming and Scripting

Modifying a sequence using positions!

Hi.. i have two files one with positions information and another is sequence information. Now i need to read the positions and take the snps at the positions and replace that position base with the snp information in the sequence and write it in the snp information file.. for example Snp file... (6 Replies)
Discussion started by: empyrean
6 Replies

4. Shell Programming and Scripting

Manipulate fields with AWK whose positions are changable

Hello Friends, I've been working with lots of different CDR-EDR files, before testing i need to manipulate my test files rather than requesting new files(to prepare them for next tests) which are different kind of CDRs,EDRs. In order to do this i might have to change more than a field in a... (3 Replies)
Discussion started by: EAGL€
3 Replies

5. Shell Programming and Scripting

awk regardless positions

brw------- 1 oracle dba 49, 21 Apr 05 11:45 dprod_0000018 brw------- 1 oracle dba 49, 26 Apr 05 11:45 dprod_0000019 brw------- 1 oracle dba 43, 93 Feb 02 2011 dprod_000002 brw------- 1 oracle dba 49, 27 Apr 05 11:45 dprod_0000020... (4 Replies)
Discussion started by: Daniel Gate
4 Replies

6. Shell Programming and Scripting

awk script replace positions if certain positions equal prescribed value

I am attempting to replace positions 44-46 with YYY if positions 48-50 = XXX. awk -F "" '{if (substr($0,48,3)=="XXX") $44="YYY"}1' OFS="" $filename > $tempfile But this is not working, 44-46 is still spaces in my tempfile instead of YYY. Any suggestions would be greatly appreciated. (9 Replies)
Discussion started by: halplessProblem
9 Replies

7. Shell Programming and Scripting

modifying a awk line

Hi, I want to print specific columns (from 201 to 1001). The line that I am using is listed below. However I also want to print column 1. So column 1 and 201 to 1001. What modifcations do I need to make? Code: awk -F'\t' 'BEGIN {min = 201; max = 1001 }{for (i=min; i<=max; i++) printf... (5 Replies)
Discussion started by: phil_heath
5 Replies

8. Shell Programming and Scripting

modifying specific lines a file

Hi I need to modify entire file starting from the 3 line. file looks like this filename : exp first line second 1,"wes","est","ws" 1,"was","qwe","qwa" also i have to replace the third content from 3 line by a counter . so the output should look like this: first line second... (12 Replies)
Discussion started by: ciba
12 Replies

9. UNIX for Dummies Questions & Answers

Exclude lines which have blanks at certain positions

Hi All, I am getting a input file which doesnt have a field seperator. The file is being sorted on certain positions say from 0.55 to 0.59. If there are any blanks from 0.55 to 0.59 they will be listed as first set of records. I am not sure abt the number of records which will have blanks at... (8 Replies)
Discussion started by: helper
8 Replies
Login or Register to Ask a Question