Sponsored Content
Top Forums Shell Programming and Scripting Cut first column from file in Vi(Vim) Post 302783315 by djehresmann on Wednesday 20th of March 2013 09:05:37 AM
Old 03-20-2013
Cut first column from file in Vi(Vim)

I have a parts file that looks like this:
Code:
EE36264|0NH46||Y|A|EA|0|0|0|N|LUNETTE 3" ADJ. EYE|0|0|*|0|PEOZZU|N|12|N|N|VPS|N|N|N|N|LUNETTE 3" ADJ. EYE|0|||Receive into Inventory|81755|EE36264|*|*|*|0|0||EE36264|A|*|*
F1.5|53932||Y|A|EA|0|0|0|N|FLAT ZERO CAL BLOCK|0|0|*|0|PEOZZU|N|12|N|N|VPS|N|N|N|N|FLAT ZERO CAL BLOCK|0|||Receive into Inventory|81755|F1.5|*|*|*|0|0||F1.5|A|*|*
F7-412-1|55723||AB|A|EA|0|0|0|N|SWITCH|1|0|*|0|PAOZZN|N|12|N|N|VPS|N|N|N|N|SWITCH|.3|||Receive into Inventory|81755|F7-412-1|*|*|*|1|0||2GFV00605-0005|A|*|*
FCO26A|55719||Y|A|EA|0|0|0|N|CRWFT 3/8DRX13/16|0|0|*|0|PEOZZU|N|12|N|N|VPS|N|N|N|N|CRWFT 3/8DRX13/16|0|||Receive into Inventory|81755|FCO26A|*|*|*|0|0||FCO26A|A|*|*
M1363400104|0NH46||Y|A|EA|0|0|0|N|DRAIN HOSE|0|0|*|0|PEOZZU|N|12|N|N|VPS|N|N|N|N|DRAIN HOSE|0|||Receive into Inventory|81755|M1363400104|*|*|*|0|0||M1363400104|A|*|*
M1490300004|0NH46||AB|A|EA|0|0|0|N|RUBBER SEAL|0|0|*|0|PEOZZU|N|12|N|N|VPS|N|N|N|N|RUBBER SEAL|0|||Receive into Inventory|81755|M1490300004|*|*|*|0|0||M1490300004|A|*|*
CA2210A4R|13002||Y|A|EA|0|0|0|N|WASH CAPTIVE L\BOLT|0|0|*|0|XBOZZN|N|12|N|N|VPS|N|N|N|N|WASH CAPTIVE L\BOLT|0|||Receive into Inventory|81755|CA2210A4R|*|*|*|0|0||CA2210A-4R|A|*|*
CL-4-BLPL-0.75-S|99862||Y|A|EA|0|0|0|N|L HANDLE, 1/4|0|0|*|0|PEOZZU|N|12|N|N|VPS|N|N|N|N|L HANDLE, 1/4|0|||Receive into Inventory|81755|CL-4-BLPL-0.75-S|*|*|*|0|0||CL-4-BLPL-0.75-S|A|*|*

It is an ascii text file ( *.csv ) that can go on for 1000s of lines.  I want to cut out the first column , the part number only.  It is delimited by a split bar "|".

Can I do this in Vi ( Vim) so I produce a file of the first column only like below?

Code:
EE36264
F1.5
F7-412-1
FCO26A
M1363400104
M1490300004
CA2210A4R
CL-4-BLPL-0.75-S

thanks.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cut the third column from a file

I have a text file which has the following data. There can be more lines in the file. But, I am only interested in these two lines which has ~ZZ~VISTN and ~ZZ~F159B segments. ISA~00~ ~00~ ~ZZ~VISTN ~ZZ~U1CAD ~051227~183 7~U~00200~000011258~0~P~< ... (8 Replies)
Discussion started by: isingh786
8 Replies

2. Shell Programming and Scripting

cut column

I have a file as below, $vi myfile aaa;20071217 bbb;20070404 ccc;20070254 " if I want to cut the column 9-12 of the first line , the output should be 1217 , can advise how to write a script to get the result ? thx p.s. can a script that have only ONE line could do that ? (5 Replies)
Discussion started by: ust
5 Replies

3. Shell Programming and Scripting

To cut entire column from a file and apend it to another file as another column

file1.txt : india pakistan bangladesh japan canada africa USA srilanka Nepal file2.txt Delhi Tokyo washington I have to cut the first column of file1.txt and apend it with file2.txt as another column like this Delhi india Tokyo japan washington USA ... (4 Replies)
Discussion started by: sakthifire
4 Replies

4. Shell Programming and Scripting

cut the first row first column value

Hi All, file create2.txt contains . /test.txt ./create.txt ./test2.txt test.txt contains inb-1|kuuhsdkjfhsd|djshfjksd|ndsbs896 inb-2|kuuhsdkjfhsd|djshfjksd|ndsbs896 inb-3|kuuhsdkjfhsd|djshfjksd|ndsbs896create.txt contains abv-1|kjsdgfjksd|sdkjbfhokjsd|skjdbfhjkosd... (8 Replies)
Discussion started by: adaleru
8 Replies

5. Solaris

Very Importan - Vim Settings - Error while opening a File using vim

I downloaded vim.7.2 and compiled the vim source . Added the vim binary path to PATH (Because iam not the root of the box) when i load the file using vim it throws me an error Error detected while processing /home2/e3003091/.vimrc: line 2: E185: Cannot find color scheme darkblue line... (0 Replies)
Discussion started by: girija
0 Replies

6. Shell Programming and Scripting

cut the last column from the link

Hi, I need to cut the last of below link lrwxrwxrwx 1 e027025 denccefs 36 Oct 21 02:30 prodcode1 -> /efare1/LINUXMTP-4/HOTFIX111019A_5U4/ after cut I need this value HOTFIX111019A_5U4 Please help me. Thanks (3 Replies)
Discussion started by: rohit22hamirpur
3 Replies

7. UNIX for Dummies Questions & Answers

How to cut from a text file based on value of a specific column?

Hi, I have a tab delimited text file from which I want to cut out specific columns. If the second column equals one, I want to cut out columns 1 and 5 and 6. If the second column equals two, I want to cut out columns 1 and 5 and 7. How do I go about doing that? Thanks! (4 Replies)
Discussion started by: evelibertine
4 Replies

8. Shell Programming and Scripting

Pick the column value based on another column using awk or CUT

My scenario is that I need to pick value from third column based on fourth column value, if fourth column value is 1 then first value of third column.Third column (2|3|4|6|1) values are cancatenated. Please someone help me to resolve this issue. Source column1 column2 column3 column4... (2 Replies)
Discussion started by: Ganesh L
2 Replies

9. UNIX for Dummies Questions & Answers

Cut the two column from non delimited file

Hi, I have a question how to cut the column from non delimited file This is my file gene_id ENSG00000223972 transcript_id ENST00000456328 exon_number 1 gene_biotype pseudogene gene_name DDX11L1 transcript_name DDX11L1-002 tss_id TSS26614 gene_id ENSG00000223972 transcript_id ENST00000515242... (1 Reply)
Discussion started by: Wan Fahmi
1 Replies

10. UNIX for Beginners Questions & Answers

Cut specific column from 2 file and merge

Hi ALL, I have two file. I need to combine these two file based on a layout. I used the below code and able to extract the record. But now able to insert that to a 3'rd file in between the extract FILE 1 CAID NUMBER 1-20 TID NUMBER 21-22 LABEL CHAR 23-44 BASE 45-60... (5 Replies)
Discussion started by: arunkumar_mca
5 Replies
dtc-xen_migrate(8)					      System Manager's Manual						dtc-xen_migrate(8)

NAME
dtc-xen_migrate - migrate a VPS to another Xen server SYNOPSIS
LOCAL_VPS_ID DESTINATION_HOSTNAME [ DEST_VPS_ID ] DESCRIPTION
dtc-xen_migrate This shell script is a part of the dtc-xen package that is to be used by the dtc panel to manage a Xen VPS server. Note that you need rsync in both the source and the destination dom0. This script is used to move the content of a Xen virtual machine (VM) managed with dtc-xen to another Xen server of the same type. The VM destination will first be prepared, then the local VM will be shut down, then it's content will be transfered over using rsync. Note that this is NOT a live migration, and down time of approximatively the time needed for the rsync will occure. PARAMETERS
LOCAL_VPS_ID The DTC-Xen id of the VM, from 00 to 99. DESTINATION_HOSTNAME Destination Xen server hostname to migrate to. DEST_VPS_ID Destination DTC-Xen id of the VM, from 00 to 99. EXAMPLE
dtc-xen_migrate 19 alpha.example.com 21 This will migrate the content of xen19 on the local machine to the destination server alpha.example.com using xen21 as VM name. SEE ALSO
dtc_reinstall_os(8), dtc_kill_vps_disk(8) dtc-xen_migrate(8)
All times are GMT -4. The time now is 07:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy