Hello,
I have a so many and big text files .txt.
I want to compare them quickly by using sas and unix commands.
Like this:
R/R1/ab.txt
...
R/R1/wa.txt
==================
R/R2/ab.txt
...
R/R2/wa.txt
I want to compare the R1 and R2 files one by one R1/ab.txt with R2/ab.txt
Thank you for your answer
Your question as it stands is vague.
1. What do you have to start off with?
2. Which part of this are you having difficulty with?
3. What do you want your output to look like?
So, if i was not clear
I have a folders :R/R1 and R/R2
In R1 and R2, I have a text files : a.ext, b.txt, .... in R1 and R2
Every file in R1, I will be in R2, I want to compare R1/a.txt with R2/a.txt
In the output, I want to get the name of the files with a diff and the difference lines in new file : R/dif/a_dif
Thank you
1. Create a listing of files from directory R1- this is relatively straightforward in a unix environment. (ls filepath or see previous posts)
2. If you're sure that you have the same in each folder you don't need to list the folders
3. Build your compare command
4. Execute compare command and store into a file or dataset
What have tried so far?
The UNIX command for comparing text files is diff. If files A and B are identical, diff A B will produce no output and return with exit code 0; differences will produce output and exit code 1, all other exit codes signal an error like file not found.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.