Cutting Columns From a File leaving the First and Last 2 Columns using cut where the number of Columns in a File is dynamic | بلاگ

Cutting Columns From a File leaving the First and Last 2 Columns using cut where the number of Columns in a File is dynamic

تعرفه تبلیغات در سایت

آخرین مطالب

امکانات وب

Vote count: 0

I have Files where the Number of Columns are dynamic and different files can have different number of Columns.

But among those Files i have a Common Objective from which i need to remove the 1st Column and the last 2 Column always from all the Files.

So i am trying to write a generic statement which can fit for all Files having different number of columns.

I am able to Remove the 1st Column using cut but got stuck how to write a statement to remove the last 2 Columns.

cat file1.dat | cut -d "|" -f 2-

The Above command removes the First Column. But not able to write a generic command to remove the last 2 columns when the number of columns are different for different files.

Please help.

asked 27 secs ago
Samrat Saha

...
نویسنده : استخدام کار بازدید : 5 تاريخ : دوشنبه 23 بهمن 1396 ساعت: 17:50