This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
directory="/path/to/directory" # Specify the directory path | |
output_file="/path/to/output/file.txt" # Specify the output file path | |
# Get the current date in the desired format | |
current_date=$(date +%y%m%d) | |
# Clear the output file if it exists | |
> "$output_file" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Wrapper script to run commands with simulated interactive activity | |
# Command and arguments to run | |
CMD="$@" | |
# Function to simulate interactive activity | |
keep_alive() { | |
while true; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Description: This script performs an incremental copy of files and directories | |
# from a source directory to a target directory, maintaining the relative directory | |
# structure, based on a specified time range in hours. The copy operation is | |
# parallelized, capable of handling multiple files and directories simultaneously. | |
# The script is useful for backing up or synchronizing large datasets with changes | |
# limited to a specific period. | |
# | |
# Usage: ./g1_incremental_copy.sh <source_dir> <target_dir> <time_range_in_hours> [number_of_processes] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
num_threads=<num_threads> | |
pattern_file="pattern_list.txt" | |
output_file="output.txt" | |
directory_path="directory_path" | |
# Read each pattern from the pattern file | |
while IFS= read -r pattern; do | |
# Run grep in the background for each pattern |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub CreateFile { | |
printLog("Started creating file", "MAIN"); | |
open INFILE, $rds_file or die("Failed to open $rds_file ($!)"); | |
$outfile = "Sudthome/batch/logs/fx_rate_bcp_load_" . time . "out"; | |
open (my $Sout, ">", $outfile) or printSyslog("Failed to open BCP out file $outfile"); | |
while (<INFILE>) { | |
chomp; | |
$row = $_; | |
$row = EscapeSpecialCharacters($row); | |
$rows++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RANDOM_SECONDS=$((RANDOM % 60)) | |
DATE_WITH_RANDOM_SECONDS=$(date -d "+${RANDOM_SECONDS} seconds" "+%Y%m%d%H%M%S") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=DATE(RIGHT(B1,4),MID(B1,4,2),LEFT(B1,2)) + TIME(MID(B1,12,2),MID(B1,15,2),MID(B1,18,2)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
padded_number=$(printf "%02d" "${string//[!0-9]}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ps -eo pid,etime,comm,user | awk '{if ($3 ~ /KL/ || $3 ~ /kl/ && $2>604800) print $1, $4}' | while read pid user; do kill $pid; echo "Killed $pid process owned by $user which started running at $(ps -o lstart= -p $pid)" >> processes.txt; done |
NewerOlder