Sponsored Content
Top Forums Shell Programming and Scripting Dig and concatenate all files yesterday then save it to another directory Post 303034325 by invinzin21 on Tuesday 23rd of April 2019 10:15:39 AM
Old 04-23-2019
the viebinary could be the string command or any application command that can view a a binary file.
Thank you

--- Post updated at 09:57 PM ---

grep -e COM e -NET -e GOV # this is what im referring to filesineed.

--- Post updated at 10:15 PM ---

Hmmmmm Almost but not quite.. The script will run, after it will search for the file for the



Code:
#For the code below, I am hoping example after string $i, i want to grep the file,. I want to know the file if it contains COM or NET or GOV, then it will move it to destination folder. But it did not happen, Also Theres an error as well aside it doesnt search for the thing. Please see below.

for i in `find ./ -mtime -1 |head -30| grep datalog`
do
  case `string "$i"` in
  ( *COM* ) dest=com;;
  ( *NET* ) dest=net;;
  ( *GOV* ) dest=gov;;
  esac
  echo cp "$i" "/tmp/$dest/$i.log"
done




The ERROR:
cp ./59/a8/9dd-225e-005056be5b.datalog /tmp/com/./59/a8/9dd-225e-005056be5b.datalog.log


Last edited by invinzin21; 04-23-2019 at 11:32 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Help me in receiving,validating emails and save them in local directory

hi, I'm working on a project where I get mails from different customers, what I need to do is I need to check if it is genuine mail and if there is any attachment I need to validate them and extract the message and save in the local directory as a text file say and then I need to direct it to... (4 Replies)
Discussion started by: sudharsanc
4 Replies

2. Shell Programming and Scripting

Checking the directory and concatenate the data of all the log files in that dir

Hi Gurus, I am new to unix and need your help to make a shell script. I have a requirement, would appreciate if you could please help me on it: Requirement: ------------- I will pass 2 parameters in shell script 1). Directory name say errors 2). file extension say .log First of all this... (4 Replies)
Discussion started by: anshulinpc
4 Replies

3. Shell Programming and Scripting

I need to back up a bunch of files on a directory and save that file as the current date....

this is what i have to find the files modified within the past 24 hours find . -mtime -1 -type f -print0 | xargs -0 tar rvf "$archive.tar" however i need to save/name this archive as the current date (MM-DD,YYYY.tar.gz) how do i doo this (1 Reply)
Discussion started by: bugenhagen_
1 Replies

4. Shell Programming and Scripting

How to get the files which has modified date as yesterday and before?

Hi All, Can you please help me to get only the files which has the modified date as yesterday and before? Thanks in advance! Regards, Velava.S (4 Replies)
Discussion started by: velava
4 Replies

5. UNIX for Dummies Questions & Answers

Find only files that changed Yesterday

Hi , I know that find / -type f -mtime -1 will show all modified files that changed 24hrs preceeding the time i run the command. This will include list of files that changed today. How do i find only files that changed yesterday staring from 00:00hrs to 23:59? Thanks HG (2 Replies)
Discussion started by: Hari_Ganesh
2 Replies

6. UNIX for Dummies Questions & Answers

Concatenate files and delete source files. Also have to add a comment.

- Concatenate files and delete source files. Also have to add a comment. - I need to concatenate 3 files which have the same characters in the beginning and have to remove those files and add a comment and the end. Example: cat REJ_FILE_ABC.txt REJ_FILE_XYZ.txt REJ_FILE_PQR.txt >... (0 Replies)
Discussion started by: eskay
0 Replies

7. Shell Programming and Scripting

Script to zip the files of yesterday

Hi I've the following requirement, where i need to zip the yesterday files every day . Yesterday's Files touch AB_XYZA_20130930183017.log touch AB_DY_XYZA_20130930183017.log touch AB_GZU_20130930183017.log touch AB_XYZA_20130930180023.log touch AB_DY_XYZA_20130930180023.log touch... (1 Reply)
Discussion started by: smile689
1 Replies

8. Shell Programming and Scripting

Save files in directory as txt

wget -x -i link.txt The above downloads and create unique entries for the 97 links in the text file. However, each new file is saved as CM080 with a FILE extention. Is there a way to convert each file in that directory to a .txt? The 97 files are in... (12 Replies)
Discussion started by: cmccabe
12 Replies

9. Shell Programming and Scripting

Save input as text in directory

I am having a little trouble with some things using the code below: 1. printf "Enter variant: "; read variant The user enters the variant and that value is used in the python script. However, I am not sure how to save that value inputed as a text file in a specific directory... (8 Replies)
Discussion started by: cmccabe
8 Replies

10. Shell Programming and Scripting

Bash to select and save file in new directory

I am trying to select a file in bash and save it to a directory. The below does run but no selected file is saved. Thank you :). bash # select file printf "please select a file to analyze with entered gene or genes \n" select file in $(cd... (4 Replies)
Discussion started by: cmccabe
4 Replies
shell(1F)							   FMLI Commands							 shell(1F)

NAME
shell - run a command using shell SYNOPSIS
shell command [command] ... DESCRIPTION
The shell function concatenate its arguments, separating each by a space, and passes this string to the shell ($SHELL if set, otherwise /usr/bin/sh). EXAMPLES
Example 1: A sample output of shell command. Since the Form and Menu Language does not directly support background processing, the shell function can be used instead. `shell "build prog > /dev/null &"` If you want the user to continue to be able to interact with the application while the background job is running, the output of an exe- cutable run by shell in the background must be redirected: to a file if you want to save the output, or to /dev/null if you don't want to save it (or if there is no output), otherwise your application may appear to be hung until the background job finishes processing. shell can also be used to execute a command that has the same name as an FMLI built-in function. NOTES
The arguments to shell will be concatenate using spaces, which may or may not do what is expected. The variables set in local environments will not be expanded by the shell because "local" means "local to the current process." ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
sh(1), attributes(5) SunOS 5.10 5 Jul 1990 shell(1F)
All times are GMT -4. The time now is 01:27 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy