Questions tagged [ifs]

IFS is a variable in Unix shells (Bourne, POSIX sh, bash, ksh, …) that controls how unescaped substitutions are split into words.

IFS (short for "input field separator" and often referred to as "internal field separator") is a variable in Unix shells (, , , , , , , , …) that controls how strings are split into multiple fields. Most notably, variable substitutions (e.g. $foo) which are not inside double quotes or in a few other protected locations are split into multiple fields based on the value of IFS; the same goes for command substitutions (e.g. $(foo)). Each character that is present in IFS is a field separator. The default value contains a space, a tab and a newline.

For other meanings of the acronym IFS, use the appropriate tag:

  • IBM Integrated file system
  • QNX Image Filesystem
  • ERP by Industrial and Financial Systems AB
293 questions
0
votes
1 answer

BASH script to create SQL statement ignore last column

I am trying to create a bash script that will generate an SQL CREATE TABLE statement from a CSV file. #!/bin/bash # Check if the user provided a CSV file if [ $# -eq 0 ] then echo "No CSV file provided." exit 1 fi # Check if the CSV file…
0
votes
1 answer

Formula to look in first column before heading

I am currently using a function in Column J as below =ArrayFormula(IFERROR(Vlookup(if(U3:U<>"",(if(U3:U<5,"Hot",if(U3:U<10,"Warm",if(U3:U<30,"Cold",if(U3:U>30,"Lost"))))),),CellRef!A1:B,2,0))) Column U contains Numerical data which return the value…
0
votes
2 answers

Checkboxes to insert value in specific cells

I am trying to implement checkboxes to populate the Home and Away Teams name in B7 and D7 when its checked and cleared when unchecked. The only formula i came up with and it doesn't work is =IF(F3,H3,"")
0
votes
1 answer

Nesting IFS statement inside DATEDIF

I am nesting an IF statement inside a DATEDIF to determine employee tenure. I am trying to write the formula in such a way that pulls the termination date if the cell is not blank, but uses today's date if the cell is blank. Here is the formula I…
0
votes
2 answers

How to use Internal Field Separator correctly?

I am trying to set the IFS to ':', but it seems to not work. Here is my code, FILE="/etc/passwd" while IFS=':' read -r line; do set $line echo $1 done < $FILE When I run my code, it seems to give me the entire line. I have used the…
Leuel Asfaw
  • 316
  • 1
  • 14
0
votes
1 answer

Lookup multiple columns in Google Sheets and return a list from the matches

I think the title accurately describes what I'm trying to achieve. https://docs.google.com/spreadsheets/d/1sRQzXXZ4a3vjAwvsH4rrWfijxV4jCl_OV3iQO00yvlQ/edit?usp=sharing Essentially, I have a table of data for houses, the street it's on, whether it…
0
votes
1 answer

IF text is found in a list

I am trying to create an IF statement that includes checking if a cell contains a text string from a list of text strings and I'm struggling with the correct way of doing it. I have a 'Global Settings' page, with the values I want to search against…
Jon Wright
  • 45
  • 4
0
votes
1 answer

=IFS formula working in Google Sheets but not Excel?

=IFS(L83<49.9,"Referral",L83<60,"Pass",L83<70,"Merit",L83<100.1,"Distinction",L83<1000,"Over Assessed") I have the above formula in one of my cells. It works perfectly fine in Google Sheets. However, once I donwload the sheet into Excel/LibreOffice…
0
votes
0 answers

Shell script read variables from file separated with comma and execute API call

I'm using bash select menu's to create a quick cli to interact with an API. Right now all is working well with the individual/prompted show, add, update, delete. I'm having a problem with the bulk "operation" which will be reading from a file,…
RPopas
  • 1
0
votes
0 answers

How to parse through nested column in text file in a shell script

I have a text file that has the following format: group A: red team: worker 1, worker 2 green team: worker 2, worker 3 Group B: Team_Blue:worker 4, worker 2 Team_Black: worker 5, worker 6 Team_Grey: worker 6 From this text file, I want to create…
Zizi96
  • 459
  • 1
  • 6
  • 23
0
votes
1 answer

Reading .txt file through shell script stops after 1st line

I want to create a shell that reads a text file. The file, users_test.txt, looks like: Headers - Group : Team : User Group_A:Team_Red Team_Green:worker_1 worker_2 worker_2 worker_3 Group_B:Team_Blue Team_Black Team_Grey:worker_4 worker_2 worker_5…
Zizi96
  • 459
  • 1
  • 6
  • 23
0
votes
1 answer

Difference between "${param[0]}" and ${1} in bash

I'm looking at some old scripts and I found some parameter assignment that I have not seen before. A while loop reads from a text file and passes the values to a function. The items in the text file look like this: user_one:abcdef:secretfolder the…
scrow
  • 357
  • 3
  • 13
0
votes
1 answer

Excel calculating conditional overtime with IFS

I'm having some issues with calculating overtime. I'm a willing novice with formulae :') Half day = 5:00 hours Overtime = up to 7:45hrs Full Day = 10:00 hours However anything over 7:45hrs constitutes a full day. So I need a conditional formula: if…
0
votes
1 answer

Array arguments to IF are of different size

I am currently working with data collected from google forms and am using google sheets. I would like to use ArrayFormula with the following, but an unable to do so, and receive the error message "Array arguments to IF are of a different size". I…
0
votes
0 answers

What is the difference between having `<` or `< <` after the `done` of a `while` loop? [Bash]

I am new with Bash, and I am extending a script made by third parts. In the following code snippet: while IFS='|' read my_var do ( # commands based on $my_var ) & done < <(psql my_db "SELECT ...") I do not undertstand what < < does. If…
Tms91
  • 3,456
  • 6
  • 40
  • 74