Score:0

newer to coding not sure if this is the correct way to manage variables for a project anyone have a second to help me?

in flag

Here is a log (I've only included the matching lines there is a lot of other stuff in the real log)

/home/steam/pavlovserver/Pavlov/Saved/Logs/Pavlov-backup-2021.07.07-08.51.08.log:[2021.07.06-17.30.30:443][570]PavlovLog: TicketValidation succeed for: 76561198149279501 Saltheili
/home/steam/pavlovserver/Pavlov/Saved/Logs/Pavlov-backup-2021.07.07-08.51.08.log:[2021.07.06-20.56.45:053][555]PavlovLog: TicketValidation succeed for: 76561198041336824 Lumenero
/home/steam/pavlovserver/Pavlov/Saved/Logs/Pavlov-backup-2021.07.07-08.51.08.log:[2021.07.06-22.22.12:299][270]PavlovLog: TicketValidation succeed for: 76561198345598849 GusRemington
/home/steam/pavlovserver/Pavlov/Saved/Logs/Pavlov-backup-2021.07.07-08.51.08.log:[2021.07.07-02.03.19:386][ 55]PavlovLog: TicketValidation succeed for: 76561198302880912 Snitchhy
/home/steam/pavlovserver/Pavlov/Saved/Logs/Pavlov-backup-2021.07.07-08.51.08.log:[2021.07.07-02.40.29:749][786]PavlovLog: TicketValidation succeed for: 76561198291769546 Jupiter
/home/steam/pavlovserver/Pavlov/Saved/Logs/Pavlov-backup-2021.07.07-08.51.08.log:[2021.07.07-03.38.14:208][307]PavlovLog: TicketValidation succeed for: 76561198220506681 Fedora

i am trying to pull info and set to variables using this

id=($(grep  'TicketValidation'  ~/pavlovserver/Pavlov/Saved/Logs/* | cut -b 153-170))
date=($(grep  'TicketValidation'  ~/pavlovserver/Pavlov/Saved/Logs/* | cut -b 58-67))
name=($(grep  'TicketValidation'  ~/pavlovserver/Pavlov/Saved/Logs/* | cut -b 171-270)

here is the format i want to get

$date PlayerName; $name PlayersID; $id

but i am having problems getting it to be on 1 line i am trying to send to array do i need to add [*] somewhere?

if i run echo ${id[@]}:

76561198149279501 76561198041336824 76561198345598849 76561198302880912 76561198291769546 76561198220506681

and that looks right but on name im getting only this echo ${name[@]}:

 Fedorarygton

if i run $ grep **'TicketValidation' ~/pavlovserver/Pavlov/Saved/Logs/* | cut -b 171-270 (the grep from the $name var)

i get

Saltheili
Lumenero
GusRemington
Snitchhy
Jupiter
Fedora

Ideas?

terdon avatar
cn flag
We can't tell you if your code will work if you don't show us your code. Please [edit] your question and i) add your code, ii) add an example input and iii) the output you expect from that input.
Billywilly joseph avatar
in flag
updated i changed it around a bit trying to find a way to work but this is where im at currently
pLumo avatar
in flag
I would look into `awk` for the whole thing.
Billywilly joseph avatar
in flag
like just restart using only awk ?
muru avatar
us flag
You seem to have CRLF line-endings. Fix it using `dos2unix`: https://askubuntu.com/questions/210183/characters-missing-in-console/210420#210420
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.