?
Solved

removing top 3 lines from multiple files

Posted on 2013-10-27
2
Medium Priority
?
184 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 2000 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your 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 …
Google Drive is extremely cheap offsite storage, and it's even possible to get extra storage for free for two years.  You can use the free account 15GB, and if you have an Android device..when you install Google Drive for the first time it will give…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

752 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