[Solved] how to convert char in octal format without standart C functions like print(f) [closed]

Decimal and octal are number bases, this only matters when presenting a number (or when inputing a number); the actual number is generally stored in binary in the computer’s memory but this doesn’t often matter to typical programs. In your case, conversion to octal generally involves extracting three bits at a time (since 23 is … Read more

[Solved] reading properties from ini file in a bash script

It can be done pretty easily using Awk, just do the below to store the contents in a bash array. read -p “Enter object to get properties for: ” objectname all_properties=($(awk -F ‘=’ -v input=”${objectname}” ‘$1 ~ input{flag=1; next} $1 ~ /\[object/{flag=0; next} flag && NF {split($0,arr,”=”); print arr[2] } config.ini)) Now loop the array … Read more

[Solved] How To Install Eclipse On Linux

1. Install Java. Don’t have Java installed? Search for and install OpenJDK Java 7 or 8 via Software Center. Or install oracle java by following this post. 2. Download Eclipse from its website. Check out your OS Type, 32-bit or 64-bit, by going to ** System Settings -> Details -> Overview,** then select download Linux … Read more

[Solved] Some troubles with using sed and awk [closed]

From what we can discern of this question, you’re attempting to create a programmatic rule to rename files ending in extensions stdout-captured, stderr-captured, and status-captured (assuming one typo) into files ending in extensions stdout-expected, stderr-expected, and status-expected, respectively. Obviously, if each of these definitions is inclusive of exactly one file, a rote mv may be … Read more

[Solved] Replacing first occurrence of comma in unix shell script

sed is your friend. The result can be stored in a new file. Give a try to this tested command below: sed s/,/\’,\’/ file.txt > result.txt The sed man page contains information. The test output: $ cat input.txt apple,orange,house foo,bar,woops $ sed s/,/\’,\’/ input.txt > result.txt $ cat result.txt apple’,’orange,house foo’,’bar,woops solved Replacing first occurrence … Read more

[Solved] split a line and print in second line [closed]

with open(‘path/to/input’) as infile: for line in infile: if line.startswith(“@”): line = line.strip() print(line) print(line.rsplit(“#”, 1)[1]) elif any(line.startswith(e) for e in “#+”): print(line.strip()) solved split a line and print in second line [closed]

[Solved] Linux ‘cut’ command line and replace

This should do the trick: #!/bin/bash INPUT=”$@” SIZE=${#INPUT} for ((i=0; i < ${SIZE}; i++)); do echo “${INPUT}” INPUT=”${INPUT:0:${i}} ${INPUT:$((i+1)):${SIZE}}” #INPUT=”$(echo “$INPUT” | sed “s/^\(.\{${i}\}\)./\1 /”)” done I added a sed option in the comment, although it creates a sub-process when you don’t really have to. 0 solved Linux ‘cut’ command line and replace

[Solved] bank, 4 atm machine input txt files, syncing information between them with semaphores

I know it’s tagged c, but since you spammed it in Lounge<C++>, let me humor you with C++: Live On Coliru #include <algorithm> #include <functional> #include <atomic> #include <fstream> #include <iostream> #include <list> #include <mutex> #include <sstream> #include <string> #include <thread> #include <vector> // not thread-aware: struct Bank { struct Account { int id; int … Read more