Solved

removing top 3 lines from multiple files

Posted on 2013-10-27
2
177 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Scripting vs. Programming languages 25 150
Sendmail STARTTLS error 37 77
Windows 2008 Server File need to monitor folder anytime file added, move to Z:\test 10 60
linux installs 6 47
Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now