awk - bash: How to modify a string within a field -


मेरे पास निम्न पंक्तियां हैं:

  field1 1-23_4_5 फ़ील्ड 3 फ़ील्ड 1 2-40_5_7 फ़ील्ड 3 फ़ील्ड 1 3-43_7_ 9 फ़ील्ड 3 । ।  

मैं दूसरे क्षेत्र को संशोधित करना चाहूंगा ताकि

1-23_4_5 हो जाता है 1-23 < / P>

मैं awk के संयोजन को सोच रहा हूं और कट चाल को करना होगा क्या इस बारे में जाने का एक आसान तरीका है?

अग्रिम में आपकी मदद के लिए बहुत बहुत धन्यवाद

awk के माध्यम से,

  $ awk 'sub (/ _ [ ^ _] * _ [^ _] * $ /, "$ 2) 1 'फ़ाइल फ़ील्ड 1 1-23 फ़ील्ड 3 फ़ील्ड 1 2-40 फ़ील्ड 3 फ़ील्ड 1 3-43 फ़ील्ड 3 sed के जरिए,  
  $ sed 's / ^ \ ([^] \ + \ * [^ _] \ + \) [^] \ + / \ 1 / g' फ़ाइल फ़ील्ड 1 1-23 फ़ील्ड 3 फ़ील्ड 1 2-40 फ़ील्ड 3 फ़ील्ड 1 3-43 फ़ील्ड 3  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

python - Calculate STD manually using Groupby Pandas DataFrame -

java - @PluginTarget(Node.class) not registering as neo4j plugin -