Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using AWK: Extract data from multiple files and output to multiple new files Post 302461683 by calitiggr on Tuesday 12th of October 2010 03:32:50 AM
Old 10-12-2010
I'm still a newbie at this but what about...

(Assuming all your files are in the same directory)

Code:
for oldfile in *;
do
   egrep 'line2' $oldfile > new-$oldfile;
done;


Last edited by calitiggr; 10-12-2010 at 04:39 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extract multiple cloumns from multiple files; skip rows and include filenames; awk

Hello, I am trying to write a bash shell script that does the following: 1.Finds all *.txt files within my directory of interest 2. reads each of the files (25 files) one by one (tab-delimited format and have the same data format) 3. skips the first 10 rows of the file 4. extracts and... (4 Replies)
Discussion started by: manishabh
4 Replies

2. Shell Programming and Scripting

need help with post:extract multiple columns from multiple files

hello, I will would be grateful if anyone can help me reply to my post extract multiple cloumns from multiple files; skip rows and include filenames; awk Please see this thread. Thanks manishabh (0 Replies)
Discussion started by: manishabh
0 Replies

3. UNIX for Dummies Questions & Answers

AWK, extract data from multiple files

Hi, I'm using AWK to try to extract data from multiple files (*.txt). The script should look for a flag that occurs at a specific position in each file and it should return the data to the right of that flag. I should end up with one line for each file, each containing 3 columns:... (8 Replies)
Discussion started by: Liverpaul09
8 Replies

4. UNIX for Dummies Questions & Answers

awk, extract last line of multiple files

Hi, I have a directory full of *.txt files. I would like to print the last line of every file to screen. I know you can use FNR for printing the first line of each file, but how do I access the last line of each file? This code doesn't work, it only prints the last line of the last file:BEGIN... (5 Replies)
Discussion started by: Liverpaul09
5 Replies

5. UNIX for Dummies Questions & Answers

Use awk to pipe output from one file into multiple files

Hi All. Thanks for your help in advance. I have a requirement to examine the number of delimiters in each record of a file. If the record has the expected number of delimiters it should be passed into a 'good' file. If it does not, the record should be passed into a 'bad' file. I have been able... (8 Replies)
Discussion started by: codestar1
8 Replies

6. Shell Programming and Scripting

awk, multiple files input and multiple files output

Hi! I'm new in awk and I need some help. I have a folder with a lot of files and I need that awk do something in each file and print a new file with the output. The input file name should be modified when I print the outpu files. Thanks in advance for help! :-) ciao (5 Replies)
Discussion started by: gabrysfe
5 Replies

7. UNIX for Dummies Questions & Answers

Extract common data out of multiple files

I am trying to extract common list of Organisms from different files For example I took 3 files and showed expected result. In real I have more than 1000 files. I am aware about the useful use of awk and grep but unaware in depth so need guidance regarding it. I want to use awk/ grep/ cut/... (7 Replies)
Discussion started by: macmath
7 Replies

8. Shell Programming and Scripting

Extract data in tabular format from multiple files

Hi, I have directory with multiple files from which i need to extract portion of specif lines and insert it in a new file, the new file will contain a separate columns for each file data. Example: I need to extract Value_1 & Value_3 from all files and insert in output file as below: ... (2 Replies)
Discussion started by: belalr
2 Replies

9. Shell Programming and Scripting

Create Multiple UNIX Files for Multiple SQL Rows output

Dear All, I am trying to write a Unix Script which fires a sql query. The output of the sql query gives multiple rows. Each row should be saved in a separate Unix File. The number of rows of sql output can be variable. I am able save all the rows in one file but in separate files. Any... (14 Replies)
Discussion started by: Rahul_Bhasin
14 Replies

10. Shell Programming and Scripting

Grep strings on multiple files and output to multiple files

Hi All, I want to use egrep on multiple files and the results should be output to multiple files. I am using the below code in my shell script(working in Ksh shell). However with this code I am not attaining the desired results. #!/bin/ksh ( a="/path/file1" b="path/file2" for file in... (4 Replies)
Discussion started by: am24
4 Replies
bcron-update(8) 					      System Manager's Manual						   bcron-update(8)

NAME
bcron-update - Update system crontabs. SYNOPSIS
bcron-update path [ path ... ] DESCRIPTION
bcron-update polls the named files or directories periodically to see if there are any new, changed, or removed files. When it detects changes, it mirrors those changes into the crontab spool directory. bcron-update runs as root in order to be able to read system files that would potentially be unreadable otherwise. On Debian, if path is a directory, bcron-update skips files in this directory with names that do not solely consist of lower- and uppercase letters ('a'-'z', 'A'-'Z'), digits ('0'-'9'), underscores ('_'), and hyphens ('-'). EXAMPLES
To mirror modern vixie-cron's behavior, use: bcron-update /etc/crontab /etc/cron.d ENVIRONMENT
BCRON_SPOOL The spool directory for bcron. Defaults to /var/spool/cron. BCRON_USER After writing files and before moving them into their final location, bcron-update changes the ownership of the file to this user so that bcron-sched can read them. SEE ALSO
bcron-sched(8) DIAGNOSTICS
bcron-update outputs three different kinds of messages about actions it is taking. Rescanning /etc/cron.d The named directory has been modified, and will be scanned to determine what files have been added or deleted. -/etc/cron.d/oldfile The named file no longer exists and will be removed from the spool. +/etc/cron.d/newfile The named file was either created or modified since the last scan, and will be copied into the spool. AUTHOR
Bruce Guenter <bruceg@em.ca> bcron-update(8)
All times are GMT -4. The time now is 09:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy