cp -rfL source dest
Monday, August 4, 2014
Linux - Copy and follow symlinks
If you want to copy and follow symlinks, use these arguments:
Tuesday, November 12, 2013
EDI - Copy only specific transaction to a folder
Hi!
Here is a simple tutorial how to copy only a specific functional group type of EDI transaction.
In my example I need to copy all the 997 ( Functional Acknowledgment) to a specific folder.
My folder hierachy is /myhome/source/folder/CLIENT / (job / folder-in / folder-out) / YEAR / MONTH / DAY / myfile
where myfile is a single ISA per file and could be gzipped.
Here is a simple tutorial how to copy only a specific functional group type of EDI transaction.
In my example I need to copy all the 997 ( Functional Acknowledgment) to a specific folder.
My folder hierachy is /myhome/source/folder/CLIENT / (job / folder-in / folder-out) / YEAR / MONTH / DAY / myfile
where myfile is a single ISA per file and could be gzipped.
1 - Extract all gzipped EDI files under folder-in and folder-outfind /myhome/source/folder -type f -iwholename *folder* -iwholename *.gz -exec zgrep -l '^ISA' {} \; -exec gunzip {} \;
2 - Copy all the 997 to /home/MY_FOLDER (Where FA is the GS Transaction code of the 997)find /myhome/source/folder -type f -iwholename *folder* -exec pcregrep -Ml '^ISA.*GS.FA' {} \; -exec cp -rf {} /home/MY_FOLDER/ \;
Wednesday, October 23, 2013
Split a big text file into many files
Hi!
Suppose that we have a big text file with 2 000 000 lines and you want to split it in 1 000 files containing 20 000 lines each.
You only have one command to type!
You will get 1 000 files.
If you are on Windows, you just have to install Cygwin Terminal
Suppose that we have a big text file with 2 000 000 lines and you want to split it in 1 000 files containing 20 000 lines each.
You only have one command to type!
split -l 20000 myfile.txt
You will get 1 000 files.
If you are on Windows, you just have to install Cygwin Terminal
Friday, October 4, 2013
Wednesday, October 2, 2013
Batch - Deleting all the files and directories under a root directory
Hi!
With Windows 7, I need to delete all the files and subdirectory under a root directory.
I was able to achieve this task with theses two commands in a batch script
The first one deletes all the files and directory under MY_DIRECTORY but it deletes also the root directory. I recreate after the root directory.
It may not be the best way to achieve this but it works.
With Windows 7, I need to delete all the files and subdirectory under a root directory.
I was able to achieve this task with theses two commands in a batch script
rmdir /S /Q MY_DIRECTORYmd MY_DIRECTORY
The first one deletes all the files and directory under MY_DIRECTORY but it deletes also the root directory. I recreate after the root directory.
It may not be the best way to achieve this but it works.
Sunday, September 29, 2013
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()
After adding Velocity to my Spring Web Application, I'm getting this error:
29.09.2013 22:44:26 WARN (AbstractMessageListenerContainer.java:696) - Execution of JMS message listener failed, and no ErrorHandler has been set.
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
...
The error is due by the conflicts between two differents version of "antlr". You need to exclude the version from velocity-tool.
So add the following exclusion to the velocity-tools maven dependency.
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<version>2.0</version>
<exclusions>
<exclusion>
<artifactId>antlr</artifactId>
<groupId>antlr</groupId>
</exclusion>
</exclusions>
</dependency>
29.09.2013 22:44:26 WARN (AbstractMessageListenerContainer.java:696) - Execution of JMS message listener failed, and no ErrorHandler has been set.
java.lang.NoSuchMethodError: antlr.collections.AST.getLine()I
...
The error is due by the conflicts between two differents version of "antlr". You need to exclude the version from velocity-tool.
So add the following exclusion to the velocity-tools maven dependency.
<dependency>
<groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId>
<version>2.0</version>
<exclusions>
<exclusion>
<artifactId>antlr</artifactId>
<groupId>antlr</groupId>
</exclusion>
</exclusions>
</dependency>
Wednesday, September 25, 2013
Tar following symlinks
Hi!
Suppose that we have to tar gzip a directory that contains two symlinks.
ROOT_DIRECTORY
SYMLINK_A
SYMLINK_B
SYMLINK_A
FILE_A
FILE_B
SYMLINK_B
FILE_C
FILE_D
If you use the usual command tar -zcvf ROOT_DIRECTORY.tgz ROOT_DIRECTORY
You will get an archive that contains two symbolic links.
ROOT_DIRECTORY
SYMLINK_A
SYMLINK_B
If you want to include the content of symbolic links, you need to add a "h" just after the "c",
You will get the directory including all the files under the ROOT_DIRECTORY
ROOT_DIRECTORY
SYMLINK_A
FILE_A
FILE_B
SYMLINK_B
FILE_C
FILE_D
Suppose that we have to tar gzip a directory that contains two symlinks.
ROOT_DIRECTORY
SYMLINK_A
SYMLINK_B
SYMLINK_A
FILE_A
FILE_B
SYMLINK_B
FILE_C
FILE_D
If you use the usual command tar -zcvf ROOT_DIRECTORY.tgz ROOT_DIRECTORY
You will get an archive that contains two symbolic links.
ROOT_DIRECTORY
SYMLINK_A
SYMLINK_B
If you want to include the content of symbolic links, you need to add a "h" just after the "c",
The command is tar -zchvf ROOT_DIRECTORY.tgz ROOT_DIRECTORY
You will get the directory including all the files under the ROOT_DIRECTORY
ROOT_DIRECTORY
SYMLINK_A
FILE_A
FILE_B
SYMLINK_B
FILE_C
FILE_D
Subscribe to:
Posts
(Atom)