What do you want to save?
Add Code snippet
New code examples
-
Shell/Bash 2021-08-26 14:40:01
bash how to transpose a column
# Basic syntax: operation producing a column of text/data | paste -s # Where paste -s prints the data on a single row # Example usage: Given a file named input_file that has these contents: A 23 B 42 C 17 cut -f 2 | paste -s awk '{print $2}' | paste -s... Add solution -
Shell/Bash 2021-08-26 11:08:02
linux head command
# SYNTAX # head [options] [file_name(s)] # OPTIONS # -n | N, prints out the furst N lines of the file(s) # -q, doesn't print out the file headers # -v, always prints out the file headers # EXAMPLE head -n 7 file.txt head -q -n 5 file1.txt file2.txt # C... Add solution -
Shell/Bash 2021-08-26 11:01:03
wget files matching pattern
# Getting http://some/site/*my_pattern* SITE="http://some/site/" PATTERN="my_pattern" wget -nv -O- $SITE | grep $PATTERN | awk -v pat=$PATTERN -F '"' '{ for (i=1; i<=NF; ++i) { if ($i ~ pat) print $i } }' | while ... Add solution -
Shell/Bash 2021-08-26 10:53:02
bash concatenate two columns
# Basic syntax using awk: awk 'BEGIN {FS="input_delimiter"; OFS="output_delimiter"}; {print $column# "sep" $column#}' input_file # Where: # - The input_delimiter is the delimiter separating columns in # the input_file # - ... Add solution -
Python 2021-08-26 10:50:02
Convert the sklearn.dataset cancer to a DataFrame.
import numpy as np import pandas as pd from sklearn.datasets import load_breast_cancer cancer = load_breast_cancer() print cancer.keys() data = pd.DataFrame(cancer.data, columns=[cancer.feature_names]) data['Target'] = pd.Series(data=cancer.target, inde... Add solution -
Shell/Bash 2021-08-26 10:45:02
fsl stats
#!/bin/sh if [ $# -lt 1 ] ; then echo "Usage: $0 <filename>" ; exit 1 ; fi img=$(remove_ext ${1}) min=$(fslstats ${img} -R | awk '{ print $1 }') max=$(fslstats ${img} -R | awk '{ print $2 }') scaling=$(echo "scale=5; 255.0 / (... Add solution -
Shell/Bash 2021-08-26 10:42:02
awk delimiter
# Basic syntax: awk -F'[:/|]' '{print $field#, $field#, ...}' input_file # Where: # - : / and | are the three field delimiters considered # - $field# is the field nuber to be printed based on the splits made # by any of the delimiters # Example usage: #... Add solution -
Shell/Bash 2021-08-26 10:40:03
bash add text to the beginning or end of every line
# Basic syntax: awk '{print "PREFIX"$0}' input_file # Prepend "PREFIX" to every row in the input_file awk '{print $0"SUFFIX"}' input_file # Append "SUFFIX" to every row in the input_file awk '{print "PREFIX&quo... Add solution -
Shell/Bash 2021-08-25 14:44:44
ubuntu check public ip command line
#4 Ways to Find Server Public IP Address in Linux Terminal #1. Using dig Utility dig +short myip.opendns.com @resolver1.opendns.com #2. Using host Utility host myip.opendns.com resolver1.opendns.com | grep "myip.opendns.com has" | awk '{print $4... Add solution
Best helpers
Zulu
+5
Calista
+5
Shivam Patel
+5
MGA
+5
Carla Walker
+5
Brad Thomas
+5
DJaye
+5
Umesh
+5
Mai0003c
+5
Pc1oad1etter
+5
Loronzo
+5
Lupa
+5
Vermilions
+5
Ian Goldby
+5
Elenaher
+5
Nerrolken
+5
OiciTrap
+5
RLHanout
+5
Hassaan
+5
JBeez
+5