Sponsored Content
Top Forums Shell Programming and Scripting Move file from one directory and update the list file once moved. Post 303015008 by sadique.manzar on Monday 26th of March 2018 04:32:58 AM
Old 03-26-2018
Have 2 files contain:

File1 have lines:

Code:
/fstest/INVESTIG/Sadiq/TEST/file001.bin
/fstest/INVESTIG/Sadiq/TEST/file002.bin
/fstest/INVESTIG/Sadiq/TEST/file003.bin
/fstest/INVESTIG/Sadiq/TEST/file004.bin

File2 have lines:

Code:
/fstest/INVESTIG/Sadiq/TEST/file001.bin
/fstest/INVESTIG/Sadiq/TEST/file002.bin
/fstest/INVESTIG/Sadiq/TEST/file003.bin
/fstest/INVESTIG/Sadiq/TEST/file004.bin
/fstest/INVESTIG/Sadiq/TEST/file005.bin
/fstest/INVESTIG/Sadiq/TEST/file006.bin
/fstest/INVESTIG/Sadiq/TEST/file007.bin
/fstest/INVESTIG/Sadiq/TEST/file008.bin
/fstest/INVESTIG/Sadiq/TEST/file009.bin
/fstest/INVESTIG/Sadiq/TEST/file010.bin

I wan to validate the file and delete the common line from file2, so the file2 should contain only non matching lines.

How can i validate and achieve it ?


Code:
while read -r line;
do
if ! grep -Fxq File1 File2
then
"delete comman for the line in File2"
fi 
done < /File1


Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 03-26-2018 at 05:57 AM.. Reason: Added CODE tags.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Move a file from windows directory to unix directory

Move a file from windows directory to unix directory, is this possible? if it is, can someone help me on this? Thanks! God bless! (1 Reply)
Discussion started by: kingpeejay
1 Replies

2. Shell Programming and Scripting

List moved files in text file

Hi. I am actually doing all of this on OSX, but using unix apps and script. I have built my own transparent rsync/open directory/mobility/etc set of scripts for the firm I work at, and it is all almost complete except for ONE THING. I have the classic problem with rsync where if a user... (0 Replies)
Discussion started by: Ashtefere
0 Replies

3. Shell Programming and Scripting

A script that will move a file to a directory with the same name and then rename that file

Hello all. I am new to this forum (and somewhat new to UNIX / LINUX - I started using ubuntu 1 year ago).:b: I have the following problem that I have not been able to figure out how to take care of and I was wondering if anyone could help me out.:confused: I have all of my music stored in... (7 Replies)
Discussion started by: marcozd
7 Replies

4. Shell Programming and Scripting

Move the latest or older File from one directory to another Directory

I Need help for one requirement, I want to move the latest/Older file in the folder to another file. File have the datetimestamp in postfix. Example: Source Directory : \a destination Directory : \a\b File1 : xy_MMDDYYYYHHMM.txt (xy_032120101456.txt) File2: xy_MMDDYYYYHHMM.txt... (1 Reply)
Discussion started by: pp_ayyanar
1 Replies

5. Shell Programming and Scripting

temporary file to file then move to directory

Ok in my bash script i have 5 options to create a simple html script. I need to create a temporary file and whatever the user types will be stored in that file using html codes. And then I have another option in which that temporary file will be moved to the public_html directory in which the user... (19 Replies)
Discussion started by: gangsta
19 Replies

6. Shell Programming and Scripting

How to create a log file that simply shows the name of a file and what directory it was moved to.

Newbie...Thank you for your help. I am creating my first script that simply generates subdirectories to organize video, music, and text files within those subdirectories from my current working directory. PROBLEM: I am trying to write a log file that contains, for each file, the original file... (0 Replies)
Discussion started by: BartleDoo
0 Replies

7. Shell Programming and Scripting

Shell script to get the latest file from the file list and move

Hi, Anybody help me to write a Shell Script Get the latest file from the file list based on created and then move to the target directory. Tried with the following script: got error. A=$(ls -1dt $(find "cveit/local_ftp/reflash-parts" -type f -daystart -mtime -$dateoffset) | head... (2 Replies)
Discussion started by: saravan_an
2 Replies

8. Shell Programming and Scripting

Move file in to directory- script

Hi In directory /mnt/upload I have about 100 000 files (*.png) that have been created during the last six months. Now I need to move them to right folders. eg: file created on 2014-10-10 move to directory /mnt/upload/20141010 file created on 2014-11-11 move to directory /mnt/upload/20141111... (6 Replies)
Discussion started by: primo102
6 Replies

9. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

10. Shell Programming and Scripting

Shell script cannot create directory and move the file to that directory

I have a script, which is checking if file exists and move it to another directory if then mkdir -p ${LOCL_FILES_DIR}/cool_${Today}/monthly mv report_manual_alloc_rpt_A_I_ASSIGNMENT.${Today}*.csv ${LOCL_FILES_DIR}/cool_${Today}/monthly ... (9 Replies)
Discussion started by: digioleg54
9 Replies
GRUB-FSTEST(1)                                                     User Commands                                                    GRUB-FSTEST(1)

NAME
grub-fstest - debug tool for GRUB filesystem drivers SYNOPSIS
grub-fstest [OPTION...] IMAGE_PATH COMMANDS DESCRIPTION
Debug tool for filesystem driver. Commands: blocklist FILE Display blocklist of FILE. cat FILE Copy FILE to standard output. cmp FILE LOCAL Compare FILE with local file LOCAL. cp FILE LOCAL Copy FILE to local file LOCAL. crc FILE Get crc32 checksum of FILE. hex FILE Show contents of FILE in hex. ls PATH List files in PATH. xnu_uuid DEVICE Compute XNU UUID of the device. -c, --diskcount=NUM Specify the number of input files. -C, --crypto Mount crypto devices. -d, --debug=STRING Set debug environment variable. -K, --zfs-key=FILE|prompt Load zfs crypto key. -n, --length=NUM Handle N bytes in output file. -r, --root=DEVICE_NAME Set root device. -s, --skip=NUM Skip N bytes from output file. -u, --uncompress Uncompress data. -v, --verbose print verbose messages. -?, --help give this help list --usage give a short usage message -V, --version print program version Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. SEE ALSO
grub-probe(8) The full documentation for grub-fstest is maintained as a Texinfo manual. If the info and grub-fstest programs are properly installed at your site, the command info grub-fstest should give you access to the complete manual. grub-fstest (GRUB) 2.02-2ubuntu8.3 July 2018 GRUB-FSTEST(1)
All times are GMT -4. The time now is 10:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy