Solved

removing top 3 lines from multiple files

Posted on 2013-10-27
2
181 Views
Last Modified: 2013-10-28
Hi
I need piece of code to process files
I have multiple files bew_to_kc*.csv  like    bew_to_kc_1.csv,bew_to_kc_2.csv,bew_to_kc_a.csv  etc  , I need to remove top 3 lines from these files and write to temp files named bew_to_kc*.temp files like bew_to_kc_1.temp,bew_to_kc_2.temp,bew_to_kc_a.temp . The number of files could change

thanks for you help

thanks
uco
0
Comment
Question by:uco
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 39604849
#!/bin/bash
for f in bew_to_kc*.csv  ; do tail +4 $f > ${f%.csv}.temp ; done
0
 
LVL 48

Expert Comment

by:Tintin
ID: 39604977
Along the lines of ozo

#!/bin/bash
for file in bew_to_kc*.csv
do
   sed 1,3d $file >${file%.csv}.temp
done

Open in new window

0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is a general practice to get rid of old user profiles on a computer  in a LAN environment. As I have been working with a company in a LAN environment where users move from one place to some other place at times. This will make many user profil…
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question