ifs

Google Sheets - Combine multiple IF Functions into one cell

一笑奈何 提交于 2021-01-28 21:26:07
问题 I'm trying to produce a SKU in Google Sheets for a product using the values of three variants (Title, Colour and Size) The product is 'Lightweight trainers' with colour variants of 'Red' and 'Blue', and the sizes range from 5 - 12. Link to spreadsheet https://docs.google.com/spreadsheets/d/1trq0X3MjR-n2THFnT8gYYlwKscnQavCeeZ8L-ifYaHw/edit?usp=sharing Aim I'm hoping to have a SKU that displays the product, the colour variant and the shoes size. Example: LW-1-8 (Lightweight trainer, colour Red,

Reading file in while loop bash scripting

本秂侑毒 提交于 2020-07-09 19:43:09
问题 I've got this code which reads an example file of /etc/passwd: #!/bin/bash OLDIFS=$IFS IFS=$'\n' while read linea resto do echo $linea echo $resto if [[ $(echo $linea | cut -d: -f6 | egrep -c 'al-03-04') == 1 ]] then finger $(cut -d: -f1) 2> fich if [[ $(egrep -c fich) == 1 ]] then echo $(echo $linea | cut -d: -f1). Inactive user else echo $(echo $linea | cut -d: -f1). Active user fi fi done < <(cat fichpasswd) IFS=$OLDIFS and this is the example file of /etc/passwd: jfer:x:5214:1007:Javier

C++基于多态的职工管理系统

别等时光非礼了梦想. 提交于 2020-03-10 22:21:21
主模块(职工管理系统.cpp) #include using namespace std; #include "workerManger.h" #include "worker.h" #include "employee.h" #include "Boss.h" #include "Manager.h" int main() { //实例化一个管理者对象 智汇代理申请 WorkerManger wm; int choice = 0; while (true) { //调用成员函数显示菜单 wm.Show_Menu(); cout << "请输入您的选择:" << endl; cin >> choice; switch (choice) { case 0://退出 wm.ExitSystem(); break; case 1://增加 wm.Add_Emp(); break; case 2://显示 wm.Show_Emp(); break; case 3://删除 wm.Del_Emp(); break; case 4://修改 wm.Mod_Emp(); break; case 5://查找 wm.Find_Emp(); break; case 6://排序 wm.Sort_Emp(); break; case 7://清空 wm.Clean_File(); break;

Bash while loop with read and IFS

人走茶凉 提交于 2020-02-06 01:33:51
问题 I have to parse a file in the following format: line1_param1:line1_param2:line1_param3: line1_param2:line2_param2:line2_param3: line1_param3:line3_param2:line3_param3: And process it line by line, extracting all parameters from current line. Currently I've managed it in such a way: IFS=":" grep "nice" some_file | sort > tmp_file while read param1 param2 param3 do ..code here.. done < tmp_file unset IFS How can I avoid a creation of a temporary file? Unfortunately this doesn't work correctly:

[GXYCTF2019]Ping Ping Ping

时光毁灭记忆、已成空白 提交于 2020-01-31 19:54:20
0x00 知识点 命令执行变量拼接 /?ip=127.0.0.1;a=g;cat$IFS$1fla$a.php 过滤bash用sh执行 echo$IFS$1Y2F0IGZsYWcucGhw|base64$IFS$1-d|sh 内联执行 将反引号内命令的输出作为输入执行 ?ip=127.0.0.1;cat$IFS$9`ls` 0x01 解题 打开题目,联想到XCTF中的一道题目 命令执行的方法大抵是加上管道符或者分号,那么试试管道符 /?ip=127.0.0.1|ls 看到flag.php index.php 试着读flag.php 看到提示空格被ban: 绕过空格的方法大概有以下几种: $IFS ${IFS} $IFS$1 //$1改成$加其他数字貌似都行 < <> {cat,flag.php} //用逗号实现了空格功能 %20 %09 ps:有时会禁用cat: 解决方法是使用tac反向输出命令: linux命令中可以加\,所以甚至可以ca\t /fl\ag 尝试 发现{被ban $IFS$1: flag被ban。。 我们先来试着读取一下index.php: /?ip=|\'|\"|\\|\(|\)|\[|\]|\{|\}/", $ip, $match)){ echo preg_match("/\&|\/|\?|\*|\<|[\x{00}-\x{20}]|\>|\'|\"|\\|\

Using IFS with echo [duplicate]

三世轮回 提交于 2020-01-16 11:13:06
问题 This question already has answers here : How can I convert an array to a comma separated list in Bash? (5 answers) Why can't I set IFS for one call of printf (2 answers) Closed 5 months ago . Why does this: arr=(1 2 4 8 16) IFS=, echo "${arr[*]}" print out 1,2,4,8,16 (which is what I want) but this doesn't: arr=(1 2 4 8 16) IFS=, echo "${arr[*]}" ? I'd like to have a temporary IFS without having to set it then reset/unset it. 来源: https://stackoverflow.com/questions/57627024/using-ifs-with

excel - Use of MAXIFS (in excel 2010)

纵饮孤独 提交于 2020-01-16 08:36:11
问题 I want to solve a stock problem. I have stock from some articles in a specific store and I want to find out which store in the same country has the highest stock of this specific item. I use the table below for information input Colom A: Article number Colom B: Country Colom C: Stock Colom D: Store number For instance: I would like to know for article 884 in Netherlands, which store has the highest stock. The outcome would be store 1. I'm not able to use the formulas MAXIFS :(. Is there a

Bash IFS ('\n'): Problems with file name detection through find command and for loop

南笙酒味 提交于 2020-01-05 03:33:12
问题 #!/bin/bash IFS='\n' declare -i count=0 AX=$(find *.iso -maxdepth 1 -type f) # Rather use AX="$(find *.iso -maxdepth 1 -type f"? # A="${AX%x}" < Could I use this when applying "" to $() in AX? But it should already include newlines like this way. edit: I don't need the trailing newlines fix. for iso in "$AX" do echo "Use "$iso"? [Y/N]?" # Outputs ALL files, IFS has no force somehow read choiceoffile shopt -s nocasematch case $choiceoffile in y ) echo "Using selected file.";; * ) continue;;

Bash IFS ('\n'): Problems with file name detection through find command and for loop

烈酒焚心 提交于 2020-01-05 03:32:13
问题 #!/bin/bash IFS='\n' declare -i count=0 AX=$(find *.iso -maxdepth 1 -type f) # Rather use AX="$(find *.iso -maxdepth 1 -type f"? # A="${AX%x}" < Could I use this when applying "" to $() in AX? But it should already include newlines like this way. edit: I don't need the trailing newlines fix. for iso in "$AX" do echo "Use "$iso"? [Y/N]?" # Outputs ALL files, IFS has no force somehow read choiceoffile shopt -s nocasematch case $choiceoffile in y ) echo "Using selected file.";; * ) continue;;

常见 Bash 内置变量介绍

谁都会走 提交于 2020-01-04 03:21:47
目录 $0 $1, $2 等等 $# $* 与 "$*" $@ 与 "$@" $! $_ $$ $PPID $? $BASH $BASH_VERSION $EUID 与 $UID $GROUPS $HOME $HOSTNAME $IFS $PATH $OLDPWD $PWD $PS1 $PS2 $PS4 $0 执行 Bash 脚本时,Bash 会自动将脚本的名称保存在内置变量 $0 中。因为 $0 基于的是实际的脚本文件名称,而不是在脚本中进行硬编码,所以在重命名脚本文件的名称后,不需要修改脚本的内容。比如下面的脚本片段: #!/bin/bash ARGS=3 # 这个脚本需要 3 个参数. E_BADARGS=65 # 传递给脚本的参数个数不对. echo "Args number is : $#" echo $0 if [ $# -ne "$ARGS" ] # 测试脚本的参数个数。 then echo "Usage: $(basename $0) first-parameter second-parameter third-parameter" exit $E_BADARGS fi # 开始干正事儿 在上面的代码中我们使用了 $(basename $0) 的写法,这是因为 $0 会包含脚本文件的路径,为了让输出看起来清爽一些,我用 $(basename $0)