Sponsored Content
Top Forums Shell Programming and Scripting How to apply a regular expression in all the files in a directory Post 302367170 by Lucky Ali on Sunday 1st of November 2009 04:24:56 PM
Old 11-01-2009
Thank you
It worked
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Let GID apply to new files in directory

Hi, Does anyone know if it is possible to override the GID which files have when they are created in a specific folder? I want the given GID for the folder to apply to the new files created in the folder, no matter what group the owner of the files have... I have tried sticky bits but doesn't... (1 Reply)
Discussion started by: linge
1 Replies

2. Shell Programming and Scripting

Regular Expression on Directory Contents

This should be an easy question for you gurus. :) How can I create a regular expression to match all files in the current directory that have only one period in their file name, and also not contain the string "abc" before the period? It would match: foo.txt foobar.log It would not... (4 Replies)
Discussion started by: blondie53403
4 Replies

3. Shell Programming and Scripting

Regular Expression to copy files

Hi All, I have a file with the contents as below. Current_path/file1 Current_path/file2 Current_path/file3 Now i want a regular expression to copy this files to cp Current_path/file1 HOME_DIR/Current_path/file1 cp Current_path/file2 HOME_DIR/Current_path/file2 cp Current_path/file3 ... (2 Replies)
Discussion started by: girish.raos
2 Replies

4. 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

5. Shell Programming and Scripting

copying files using regular expression

I have 3 files names as HU123.IHS ,SU345.IHS DU567.IHS I have written a script to copy the files to the destination server but I am getting the error. /bin/cp '/dun/homes/11.3.7/packages/HU*.IHS' /dun/homes/11.3.7/Target But I am getting one error :- /bin/cp: cannot stat... (1 Reply)
Discussion started by: maitree
1 Replies

6. Shell Programming and Scripting

apply record separator to multiple files within a directory using awk

Hi, I have a bunch of records within a directory where each one has this form: (example file1) 1 2 50 90 80 90 43512 98 0909 79869 -9 7878 33222 8787 9090 89898 7878 8989 7878 6767 89 89 78676 9898 000 7878 5656 5454 5454 and i want for all of these files to be... (3 Replies)
Discussion started by: amarn
3 Replies

7. Programming

Perl: How to read from a file, do regular expression and then replace the found regular expression

Hi all, How am I read a file, find the match regular expression and overwrite to the same files. open DESTINATION_FILE, "<tmptravl.dat" or die "tmptravl.dat"; open NEW_DESTINATION_FILE, ">new_tmptravl.dat" or die "new_tmptravl.dat"; while (<DESTINATION_FILE>) { # print... (1 Reply)
Discussion started by: jessy83
1 Replies

8. UNIX for Dummies Questions & Answers

Compare files with regular expression

Readers, Reading a previous post about comparing files using awk ('awk-compare-2-columns-2-files-output-whole-line', https://www.unix.com/shell-programming-scripting/168432-awk-compare-2-columns-2-files-output-whole-line.html), it is possible to adjust this, so that regular expression can be used... (8 Replies)
Discussion started by: linuxr
8 Replies

9. Shell Programming and Scripting

Apply argument to all files in directory

Hi all: i need to run a rather simple command-line argument: head -200 input > output However, I need to do it on several files, all in the same directory. Is this possible? (2 Replies)
Discussion started by: owwow14
2 Replies

10. Shell Programming and Scripting

How to find regular expression for two files?

I have files: sum_<INPUT FILENAME>.YYYYMMDDhhmmss.csv and sum_details_<INPUT FILENAME>.YYYYMMDDhhmmss.csv I have no idea, what is input filename, but in the code I would like to catch them in case I process them in the loop above case statement for *.${Today}.*.txt... (3 Replies)
Discussion started by: digioleg54
3 Replies
APPLY(1)						    BSD General Commands Manual 						  APPLY(1)

NAME
apply -- apply a command to a set of arguments SYNOPSIS
apply [-a c] [-d] [-#] command argument ... DESCRIPTION
The apply utility runs the named command on each argument argument in turn. Character sequences of the form ``%d'' in command, where 'd' is a digit from 1 to 9, are replaced by the d'th following unused argument. In this case, the largest digit number of arguments are discarded for each execution of command. The options are as follows: -# Normally arguments are taken singly; the optional number -# specifies the number of arguments to be passed to command. If the number is zero, command is run, without arguments, once for each argument. If any sequences of ``%d'' occur in command, the -# option is ignored. -a c The use of the character '%' as a magic character may be changed with the -a option. -d Display the commands that would have been executed, but do not actually execute them. ENVIRONMENT
The following environment variable affects the execution of apply: SHELL Pathname of shell to use. If this variable is not defined, the Bourne shell is used. EXAMPLES
apply echo a* is similar to ls(1); apply -2 cmp a1 b1 a2 b2 a3 b3 compares the `a' files to the `b' files; apply -0 who 1 2 3 4 5 runs who(1) 5 times; and apply 'ln %1 /usr/joe' * links all files in the current directory to the directory /usr/joe. FILES
/bin/sh default shell AUTHORS
Rob Pike BUGS
Shell metacharacters in command may have bizarre effects; it is best to enclose complicated commands in single quotes (''). HISTORY
The apply command appeared in 4.2BSD. BSD
April 4, 1994 BSD
All times are GMT -4. The time now is 06:47 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy