- Mark as New
- Follow
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report
Hi @kotisyamala ,
I don't think you might be able to check the file header efficiently using data loading itself. I would suggest you use a shell script activity or a JS activity for this evaluation. The shell script could be like
fileA="path to the file downloaded"
fileB="path to file with header"
head -1 $fileA | grep "$(cat $fileB)"
if [[ $? -ne 0 ]] ;
then
echo "fileA header does not match with fileB"
exit 1;
fi
You may use an Advanced JavaScript code activity instead of shell script activity, with the following code:
var fileA="path to the file downloaded"
var fileB="path to file with header"
var file = new File(fileA);
file.open("r", File.CODEPAGE_UTF8);
var headerOfDownload = file.readln();
var originalHeader = loadFile(fileB,"utf-8")
logInfo(headerOfDownload);
logInfo(originalHeader);
if(headerOfDownload.trim() == originalHeader.trim()) {
task.postEvent(task.transitionByName('match'));
} else {
task.postEvent(task.transitionByName('nomatch'));
}You can use the 'nomatch' transition to alert the respective operators. Hope it helps.
Views
Replies
0 Likes
Total Likes