Quote:
Originally Posted by hwang163
Hello, Linux community, I'm new to Linux. I'm running a simulation package on Linux. For each iteration, a file as below will be generated. I need to do some modification and then use the modified file as an input for the next iteration. I want to finish this modification by shell script then I don't need to do it manually after each iteration. The modification is as follows: there are x y z coordinates from the 9th line (below Direct). The third column of each line should be multiplied by a constant (say 1.03). How should I do it in shell script?
Code:
POSCAR for FCC Cu (created manually)
1.00000000000000
7.6799999999999997 0.0000000000000000 0.0000000000000000
3.8399999999999999 6.6509999999999998 0.0000000000000000
0.0000000000000000 0.0000000000000000 41.0000000000000000
72 40 40
Selective dynamics Direct
0.0000000000000000 0.0000000000000000 1.0000000000000000 F F F
0.9999979999999979 0.3328410000000019 1.0000000000000000 F F F
0.9999960000000030 0.6656819999999968 0.0000000000000000 F F F
0.3328369999999978 0.0000000000000000 0.0000000000000000 F F F
0.3328360000000004 0.3328410000000019 2.0000000000000000 F F F
0.3328339999999983 0.6656819999999968 3.0000000000000000 F F F
0.6656750000000002 0.0000000000000000 5.0000000000000000 F F F
0.6656729999999982 0.3328410000000019 2.0000000000000000 F F F
0.6656710000000032 0.6656819999999968 1.0000000000000000 F F F
|
Post what you've written/tried so far, and tell us where you're stuck. But we're not going to write your shell scripts for you...there are MANY thousands of tutorials you can find on Google for bash shell scripting, and manipulating files. They have examples and ample explanations, and should be able to get you started. There is even a tutorial in my posting signature.
Show us what you've done/tried, and we'll help. If you only want the 9th line, you can either use awk or sed to do this. For example:
Code:
awk 'NR==9{print $0}' filename ***OR*** sed 9!d filename