Created
June 17, 2025 09:42
-
-
Save stephankoelle/c231cea6038c70b2126b3fe373e5e77b to your computer and use it in GitHub Desktop.
Find the sessionId (sessionId intersection) that visited a list of productIds
This file contains hidden or 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 | |
| set -e | |
| file=/opt/epoq/wildfly/standalone/log/access* | |
| for pid in 40683780 406837806 732586891 732586894 732586900 ; do | |
| echo $file | |
| cat $file | grep -a $pid | perl -nle 'print $1 if /sessionId=(.*?)&/;' > /tmp/mop/$pid.data | |
| done | |
| # List of files | |
| files=($(ls *.data)) | |
| rm -f common_session_ids.txt final_common_session_ids.txt | |
| # Extract session IDs from the first file | |
| cat ${files[0]} > common_session_ids.txt | |
| # Loop through the remaining files and find the common session IDs | |
| for file in "${files[@]:1}"; do | |
| cat "$file" > temp_session_ids.txt | |
| comm -12 <(sort common_session_ids.txt) <(sort temp_session_ids.txt) > final_common_session_ids.txt | |
| mv final_common_session_ids.txt common_session_ids.txt | |
| done | |
| cat common_session_ids.txt | sort | uniq |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment