awk -F: '
/\{|\}|border|max-width|^$/ { print $0 }
!/\{|\}|border|max-width|^$/ {
split( substr($2, 1, length($2)-1) , a," ");
res = "";
for (i in a) {
ind = match(a[i], /[0-9]+px/)
if (ind != 0) {
a[i] = sprintf ("%.2frem", a[i]/10);
}
res=a[i] " " res;
}
res = substr(res, 1, length(res)-1);
print $1 ": " res ";"
}
' some.css
Arrays in awk are different—they are associative. This means that each array is a collection of pairs—an index and its corresponding array element value...
The pairs are shown in jumbled order because their order is irrelevant.
awk -F: '{
if ($0 ~ /\{|\}|border|max-width|^$/ ) { print $0 }
else {
res = "";
split( substr($2, 1, length($2)-1) , a, " ");
for (i=1; i<= length(a);i++) res = res " " ((match(a[i], /[0-9]+px/) != 0)? a[i]/10"rem" : a[i]);
print $1 ": " res";"
}
}' some.css
sed -r '
s/(className="[^"]+)([A-Z])([^"]+)([A-Z])([^"]+)([A-Z])([^"]+")/\1-\L\2\3-\L\4\5-\L\6\7/g;
s/(className="[^"]+)([A-Z])([^"]+)([A-Z])([^"]+")/\1-\L\2\3-\L\4\5/g;
s/(className="[^"]+)([A-Z])([^"]+")/\1-\L\2\3/g
' input_file > output_file
sed -i -r '
s/(className="[^"]+)([A-Z])([^"]+)([A-Z])([^"]+)([A-Z])([^"]+")/\1-\L\2\3-\L\4\5-\L\6\7/g;
s/(className="[^"]+)([A-Z])([^"]+)([A-Z])([^"]+")/\1-\L\2\3-\L\4\5/g;
s/(className="[^"]+)([A-Z])([^"]+")/\1-\L\2\3/g
' *.jsx
## запускаем tmux и отправляем его в фон, добавив в конце строки &
## где ... - это ваши параметры запуска tmux
tmux ... &
## ждем 610 сек и прибиваем tmux
sleep 610 && killall -9 tmux
#!/bin/bash
tmux new-session \; \
send-keys 'htop' C-m \; \
split-window -v -p 75 \; \
split-window -h -p 30 \; \
send-keys 'watch -n1 sensors' C-m \; \
select-pane -t 1 \; \
split-window -h \; \
send-keys './disk.sh' C-m \; \
split-window -v -p 20 \; \
send-keys './stress.sh' C-m \; &
sleep 610 && kill -9 $!
:a;N;$!baвесь текст становится одной строкой, поэтому немного по другому надо регулярки, см. ниже:
sed '/title/d
:a;N;$!ba
s/ \{2,\}//g
s#\s*</td>\s*</tr>\s*<tr>\s*<td>\s*#\n#g
s#\s*</td>\s*<td>\s*#;#g
s/<[^>]\+>//g
s/\n\{2,\}//g' /dev/shm/ex01.html
### Convert HTML to CSV
sed ':a;N;$!ba
s/<html.\+<table[^>]\+>//Ig
s#\s*</td>\s*</tr>\s*<tr>\s*<td>\s*#\n#Ig
s#\s*</td>\s*<td>\s*#;#Ig
s/<[^>]\+>//g;s/\s\{2,\}//g' somreport.html
awk '{print $9}' PPP_genes.gff3.txt | head -3 | cut -d";" -f 3
awk '{print $9}' PPP_genes.gff3.txt | head -3 | grep -oP ";\KName=[^;]+"
awk '{print $9}' PPP_genes.gff3.txt | head -3 | sed 's/.*\(Name=[^;]*\).*/\1/'
[[ '`awk '{print $9}' PPP_genes.gff3.txt | head -3`' =~ .*(Name=[^;]+) ]] &&
echo ${BASH_REMATCH[1]}
zenity --forms --title="Add Friend" \
--text="Enter information about your friend." \
--separator="," \
--add-entry="First Name" \
--add-entry="Family Name" \
--add-entry="Email" \
--add-calendar="Birthday"