B
B
brar2016-06-03 12:58:55
linux
brar, 2016-06-03 12:58:55

How to copy lines by mask to a new file entirely?

Colleague majetree gave the solution before. But, since my question was not clearly formulated, it remains to ask something else. Actually, I create a question for him to mark his answer and then the solution.
on command

awk -v N=1 -F"," '{print $N}' pro3.csv | grep -E '^[0-9]{11}$' >> proOUT.csv

Only a selection of column1 values ​​is copied to the new file.
Is it possible to make sure that all lines are copied completely, where there are matches?
So that the resulting file looks like this:
Идентификатор,Длина,Вес
00000002406,2,1
00000000974,5,1
00000001261,2,н.в
00000000980,7,1
00000000987,11,8
00000003281,4,5

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2016-06-03
@brar

As an option, with a simple one-liner on pearl, your task is completely solved:
Индекс у words[1] - номер столбца, в котором ищете 11-значное числовое значение, начиная с 0

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question