Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Using Awk within awk to read all files in directory Post 302354742 by flevongo on Saturday 19th of September 2009 03:20:23 PM
Old 09-19-2009
thanks vidyadhar85...
that works for one file. So I would have to do that for every file in the dirctory. I was hoping there was a way to do that for all the files in the directory with a single command from the prompt.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk read input files

hi, i'm a beginner in writing awk scripts and I have a problem with reading input files. Requirement for my programm: compare file1 to file2 and check if value in column1 is equal and value in column5 is different. File 1: 180 P 01.01.2008 30.06.2008 2 180 P 01.07.2008 ... (10 Replies)
Discussion started by: tgooper
10 Replies

2. UNIX for Dummies Questions & Answers

Writing awk script to read csv files and split them

Hi Here is my script that calls my awk script #!/bin/bash set -x dir="/var/local/dsx/csv" testfile="$testfile" while getopts " f: " option do case $option in f ) testfile="$OPTARG";; esac; done ./scriptFile --testfile=$testfile >> $dir/$testfile.csv It calls my awk... (1 Reply)
Discussion started by: ladyAnne
1 Replies

3. Shell Programming and Scripting

Apply 'awk' to all files in a directory or individual files from a command line

Hi All, I am using the awk command to replace ',' by '\t' (tabs) in a csv file. I would like to apply this to all .csv files in a directory and create .txt files with the tabs. How would I do this in a script? I have the following script called "csvtabs": awk 'BEGIN { FS... (4 Replies)
Discussion started by: ScKaSx
4 Replies

4. UNIX for Advanced & Expert Users

Use awk to read multiple files twice

Hi folks I have a situation where I am trying to use awk to compute mean and standard deviation for a variable that spans across multiple files. The layout of each file is same and arranged in 3 columns and uses comma as a delimiter. File1 layout: col1,col2,col3 0,0-1,0.2345... (13 Replies)
Discussion started by: scandy
13 Replies

5. Shell Programming and Scripting

awk command to compare a file with set of files in a directory using 'awk'

Hi, I have a situation to compare one file, say file1.txt with a set of files in directory.The directory contains more than 100 files. To be more precise, the requirement is to compare the first field of file1.txt with the first field in all the files in the directory.The files in the... (10 Replies)
Discussion started by: anandek
10 Replies

6. UNIX for Dummies Questions & Answers

awk - how to read multiple files

Hi, is there a ways to read multiple files in a single awk command? For example: awk -f awk_script file1 file2 file3 I've google it, most of them suggest using FNR. But I don't understand how it works. It will be a great help if someone able to explain it in simple term with some example. (4 Replies)
Discussion started by: KCApple
4 Replies

7. Shell Programming and Scripting

Using awk on multiple files in a directory

so i have a file system: /data/projects in this file system, there's about 300 files. on all files in this directory, i'm running: egrep -r 'Customer.*Processed' /data/projects/* is there an efficient (fast) awk way of searching through each file in the directory and providing an... (9 Replies)
Discussion started by: SkySmart
9 Replies

8. Shell Programming and Scripting

Splitting Files with awk into other directory

I am trying to split into different files using awk: cat files | gawk '$1 ~ /---/ || $1 ~ /^deleting$/ || $1 ~ /^sorting$/ || $1 ~ /==/ {print}'| gawk '$1 ~ /---/ || $1 ~ /^deleting$/ || $1 ~ /^sorting$/ || $1 ~ /==/ {print}' |gawk '//{x="F"++i;}{print > x;}' What I am trying to do is make F*... (3 Replies)
Discussion started by: newbie2010
3 Replies

9. Shell Programming and Scripting

Iterating awk over a directory of files?

I need to run the same awk function over an entire directly of files. This is the awk: awk '{$(NF+1)=1}1' Is there a way that I can run this command once over all of the files, along the lines of: awk '{$(NF+1)=1}1' * so that I do not have to run this several times? My main concern is... (2 Replies)
Discussion started by: owwow14
2 Replies

10. Shell Programming and Scripting

awk separate files to one directory

I am trying to output all files that are made by this awk to a specific directory. awk -F '' '{f = $3 ".txt"; print > f}' input.txt Since the actual data has several hundred files I redirect the output (well tried to) to a directory. awk -F '' '{f = $3 ".txt"; close($3 ".txt")} print >... (6 Replies)
Discussion started by: cmccabe
6 Replies
SRM(1)							      General Commands Manual							    SRM(1)

NAME
srm - securely remove files or directories SYNOPSIS
srm [OPTION]... FILE... DESCRIPTION
srm removes each specified file by overwriting, renaming, and truncating it before unlinking. This prevents other people from undeleting or recovering any information about the file from the command line. srm, like every program that uses the getopt function to parse its arguments, lets you use the -- option to indicate that all following arguments are non-options. To remove a file called '-f' in the current directory, you could type either "srm -- -f" or "srm ./-f". OPTIONS
-d, --directory ignored (for compatibility with rm(1)) -f, --force ignore nonexistent files, never prompt -i, --interactive prompt before any removal -r, -R, --recursive remove the contents of directories recursively -s, --simple only overwrite with a single pass of random data -m, --medium overwrite the file with 7 US DoD compliant passes (0xF6, 0x00, 0xFF, random, 0x00, 0xFF, random) -z, --zero after overwriting, zero blocks used by file -n, --nounlink overwrite file, but do not rename or unlink it -v, --verbose explain what is being done --help display this help and exit --version output version information and exit NOTES
srm can not remove write protected files owned by another user, regardless of the permissions on the directory containing the file. The -s option overrides the -m option, if both are present. If neither is specified, the 35-pass Gutmann algorithm is used. Development and discussion of srm is carried out at <http://sourceforge.net/project/?group_id=3297>, which is also accessible via <http://srm.sourceforge.net>. SEE ALSO
rm(1) Mac OS X 20 September 2004 SRM(1)
All times are GMT -4. The time now is 10:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy