Solved

removing top 3 lines from multiple files

Posted on 2013-10-27
2
183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

691 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