• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Search

file

Bash Variables

June 27, 2020

Here’s how to read Bash variables from another file.

Contents of config.sh

#!/bin/bash
var1='thisisvariableone'
var2='thisisvariabletwo'

#!/bin/bash var1='thisisvariableone' var2='thisisvariabletwo'

Call config.sh from another script.

#!/bin/bash
source config.sh
echo var1
echo var2

#!/bin/bash source config.sh echo var1 echo var2

This is extremely helpful if you have multiple scripts using a common variable. You just to update one file instead of multiple files. All the other scripts will read and pick up the same variables from a config file. You can use this to setup your global variables.

Filed Under: Linux Tagged With: another, bash, file, source, variable

Split A Large File

January 7, 2020

How to split a large file.

split -b 500MB httpd.log
ll -lh
total 1.9G
-rw-r--r-- 1 root root 954M Mar 25 12:35 httpd.log
-rw-r--r-- 1 root root 477M Mar 25 12:38 xaa
-rw-r--r-- 1 root root 477M Mar 25 12:38 xab

split -b 500MB httpd.log ll -lh total 1.9G -rw-r--r-- 1 root root 954M Mar 25 12:35 httpd.log -rw-r--r-- 1 root root 477M Mar 25 12:38 xaa -rw-r--r-- 1 root root 477M Mar 25 12:38 xab

Split with an output file.

split -b 200M httpd.log split.log
ll -lh
total 1.9G
-rw-r--r-- 1 root root 954M Mar 25 12:35 httpd.log
-rw-r--r-- 1 root root 200M Mar 25 12:52 split.logaa
-rw-r--r-- 1 root root 200M Mar 25 12:52 split.logab
-rw-r--r-- 1 root root 200M Mar 25 12:52 split.logac
-rw-r--r-- 1 root root 200M Mar 25 12:52 split.logad
-rw-r--r-- 1 root root 154M Mar 25 12:52 split.logae

split -b 200M httpd.log split.log ll -lh total 1.9G -rw-r--r-- 1 root root 954M Mar 25 12:35 httpd.log -rw-r--r-- 1 root root 200M Mar 25 12:52 split.logaa -rw-r--r-- 1 root root 200M Mar 25 12:52 split.logab -rw-r--r-- 1 root root 200M Mar 25 12:52 split.logac -rw-r--r-- 1 root root 200M Mar 25 12:52 split.logad -rw-r--r-- 1 root root 154M Mar 25 12:52 split.logae

Filed Under: Linux Tagged With: file, large, output, split

Tail A File in Windows Server

November 19, 2019

Linux has tail command. What about Windows? You can use Powershell to tail a file.

Get-Content myLog.log –Wait

Get-Content myLog.log –Wait

Filed Under: Windows Tagged With: file, log, powershell, tail, windows

Convert File to UTF-8

August 19, 2019

Here’s how to convert multiple files to UTF-8 format.

for file in *.csv; do
    iconv -f ascii -t utf-8 "$file" -o "${file%.txt}.utf8.csv"
done

for file in *.csv; do iconv -f ascii -t utf-8 "$file" -o "${file%.txt}.utf8.csv" done

Filed Under: Cloud, Linux Tagged With: convert, file, utf-8

Matrox Monarch Configuration

July 4, 2019

You can import the Matrox Monarch HD configuration on boot up from a web page. Go to:

Command Center > Automatic Configuration.
Type in URL Address starting with https.
Check "Load settings on device reboot."
You can either power off the device or hit reset.
Holding reset for more than 5 seconds does a factory reset.
On next bootup, device will have configuration contained from the remote file.

Command Center > Automatic Configuration. Type in URL Address starting with https. Check "Load settings on device reboot." You can either power off the device or hit reset. Holding reset for more than 5 seconds does a factory reset. On next bootup, device will have configuration contained from the remote file.

Filed Under: Misc Tagged With: configuration, file, live streaming, matrox, monarch, remote, web

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Go to Next Page »
  • Home
  • About
  • Search

Copyright © 2023