Engineering Solutions

To Split a Punch File in UNIX

To Split a Punch File in UNIX

Previous topic Next topic No expanding text in this topic  

To Split a Punch File in UNIX

Previous topic Next topic JavaScript is required for expanding text JavaScript is required for the print function  

The quickest way to split a file is in UNIX using the Vi text editor.

In this example, the file s11p1s1disp2001.pch is used.  It has only one SUBCASE containing DISPLACEMENT and STRESS results.

1.Know where (what line) to split. At the prompt, use the less command:

less s111p1s1disp2001.pch

The file is loaded one buffer at a time, eliminating problems related to large file size.

2.Use the /STRESS command to locate the first STRESS.  In this example, the file will be split between DISPLACEMENT and STRESS.

punch1

The result from the above command is

punch2

3.In the screen shown above, the STRESS data begins at line 9277. Using the head and tail commands, split s111p1s1disp2001.pch into dispall.pch (DISPLACEMENT only) and stressall.pch (STRESS only).
Use the following command to create dispall.pch:

head –9276 s111p1s1disp2001.pch > dispall.pch

Line 1 to line 9276 of file s11p1s1disp2001.pch is copied into dispall.pch.

Use the following command to create stressall.pch:

tail +9277 s111p1s1disp2001.pch > stressall.pch

Line 9277 to the end of file s11p1s1disp2001.pch is copied into stressall.pch.

4.The SUBCASE numbers in dispall.pch and stressall.pch are both 1.  Therefore, the SUBCASE number in stressall.pch file should be changed to 2 (or anything other than 1).