私は以下の2つの値(Time、C_F [6])を抽出したいファイルがあります。そのCentOS 7環境では、bashやgnuplotやrを使うことができます。私はどのようにgoogleを(たとえば、ファイルbashからの値を抽出することは実際に解決策を思いつくわけではない)方法についてもわからない。それは可能ですか?ファイルからの値の抽出と平均
私ができるようにしたいと思います:[6]
EDIT 1 C_F対
- プロット時間:
これは行にある可能性がありますが、ファイル全体を再現します のsedの/^.* C_F [6] = //」C_F.pressure>
EDIT 2 OUTPUTFILE:
Extract of the file: /*---------------------------------------------------------------------------*\ | ========= | | | \\ /F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 3.0.0 | | \\/ A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ Build : 3.0.0-6abec57f5449 Exec : patchAverage p C_F -parallel Date : Apr 15 2017 Time : 15:01:20 Host : "login2.jjj.uk" PID : 59764 Case : /nobackup/jjjj/Silsoe/Solid/solid_0_LES/motorBikeLES nProcs : 8 Slaves : 7 ( "login2.jjjj.59765" "login2.jjjj.59766" "login2.jjjj.59767" "login2.jjjj.59768" "login2.jjjj.59769" "login2.jjjj.59770" "login2.jjjj.59771" ) Pstream initialized with: floatTransfer : 0 nProcsSimpleSum : 0 commsType : nonBlocking polling iterations : 0 sigFpe : Enabling floating point exception trapping (FOAM_SIGFPE). fileModificationChecking : Monitoring run-time modified files using timeStampMaster allowSystemOperations : Allowing user-supplied system call operations // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // Create time Create mesh for time = 0.18 Time = 0.18 Reading volScalarField p Average of volScalarField over patch C_F[6] = -18.3176 Time = 0.19 Reading volScalarField p Average of volScalarField over patch C_F[6] = -18.299 Time = 0.2 Reading volScalarField p Average of volScalarField over patch C_F[6] = -18.2704 Time = 0.21 Reading volScalarField p Average of volScalarField over patch C_F[6] = -18.2349
サンプルファイルをリンクできますか?これらの場合、ファイルの 'readLine'のような関数を使って行を抽出し、' Time = 'や' C_F [6]のようなパターンを含む行( 'grep'などの関数を使って) '。そして、それらの行をきれいにして、数字の部分が残るようにしてください。 '// ***************'からテキストを貼り付けてコピーすることができます。 – din