Sponsored Content
Full Discussion: how to change IFS in arrays
Top Forums Shell Programming and Scripting how to change IFS in arrays Post 302256628 by joeyg on Monday 10th of November 2008 09:31:41 AM
Old 11-10-2008
Tools

You can change the IFS beforehand, however you must remember to change it back. Keep in mind that spaces in datafields can cause other issues elsewhere also. (For instance, if you are going to use awk on the data, you would have the same issue.)
Something I often do is tr " " "_" or tr " " "~" before storing data, then reverse the tr command later in my processing. That way, I maintain the spacing integrity throughout.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

the IFS variable

Hi all, Ok os heres my situation. I have created a database style program that stores a persons info (name,address,phone number etc.) in a file ("database"). after i read in all the values above, i assign them to a line variable: line="$name^$address^$phonenum" >> phonebuk as you can see... (1 Reply)
Discussion started by: djt0506
1 Replies

2. UNIX for Dummies Questions & Answers

IFS variable

How can I set the value for IFS variable (2 Replies)
Discussion started by: mahabunta
2 Replies

3. UNIX for Dummies Questions & Answers

Help on IFS command!

Hi! I am working in korn shell. I want to reset the dimiliter for the set command to "|" but instead of a command prompt return I am getting something as below After issuing the command I am getting this....as if the shell is expecting something else. Can anybody suggest what's the problem. ... (2 Replies)
Discussion started by: udiptya
2 Replies

4. Shell Programming and Scripting

regarding IFS=

hi i am a learner can some explain "export IFS=$(echo "\n\t\a")" i am not able to understand the functionality please help thanks Satya (1 Reply)
Discussion started by: Satyak
1 Replies

5. Shell Programming and Scripting

read and IFS

Hi, This is out of curiosity: I wanted to extract year, month and date from a variable, and thought that combining read and IFS would help, but this doesn't work: echo "2010 10 12" | read y m d I could extract the parts of the date when separated by a -, and setting IFS in a subshell: ... (3 Replies)
Discussion started by: raphinou
3 Replies

6. Shell Programming and Scripting

How to use IFS in this scenario?

Given the scenario like this, if at all if have to use IFS on the below given example, how it should be used. IFS=/ eg: /xyz/123/348/file1 I want to use the last slash /file1 . So can anyone, suggest me how to pick the last "/" as a IFS. (4 Replies)
Discussion started by: raghunsi
4 Replies

7. Programming

question about int arrays and file pointer arrays

if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
Discussion started by: omega666
1 Replies

8. Shell Programming and Scripting

While loop and IFS?

Hi, while ; do echo "Please enter " read enter yyyy=${enter:0:4} mm=${enter:5:2} dd=${enter:8:2} result=`validateDate $yyyy $mm $dd` When does the loop keeping repeating till?? till 1 is equal to 1? what does this mean "${enter:0:4}" .The 0 and 4 part?? ... (3 Replies)
Discussion started by: sid22
3 Replies

9. Shell Programming and Scripting

Nested ifs

hi I keep getting an error with this nested if statement and am getting the error unexpected end of file, can anyone help me as to why this wont execute? #!/bin/bash #script to check wether the -i -v statements run correctly removeFile () { mv $1 $HOME/deleted }... (3 Replies)
Discussion started by: somersetdan
3 Replies

10. Shell Programming and Scripting

Remote while IFS

Hello masters of scripting, I've been working to develop some basic monitoring scripts. I have solved one problem, but want to know how to solve the other. I have a script that runs locally to create an output file with the Linux system kernel paramters, preceeded by the system name: ... (2 Replies)
Discussion started by: LinuxRacr
2 Replies
diffmk(1)						      General Commands Manual							 diffmk(1)

Name
       diffmk - mark differences between files

Syntax
       diffmk name1 name2 name3

Description
       The  command compares two versions of a file and creates a third file that includes ``change mark'' commands for or The name1 and name2 are
       the old and new versions of the file.  The command generates name3, which contains the lines of	name2  plus  inserted  formatter  ``change
       mark''  (.mc) requests.	When name3 is formatted, changed or inserted text is shown by | at the right margin of each line.  The position of
       deleted text is shown by a single *.

       The command can be used to produce listings of C (or other) programs with changes marked.  A typical command line for such use is the  fol-
       lowing:
       diffmk old.c new.c tmp; nroff macs tmp | pr
       In this example the file macs contains:

	      .pl 1
	      .ll 77
	      .nf
	      .eo
	      .nc `

       The  .ll request might specify a different line length, depending on the nature of the program being printed.  The .eo and .nc requests are
       probably needed only for C programs.

       If the characters | and * are inappropriate, a copy of can be edited to change them.  The command is a shell procedure.

Restrictions
       Aesthetic considerations may dictate manual adjustment of some output.  File differences involving only	formatting  requests  may  produce
       undesirable output, that is, replacing .sp by .sp 2 will produce a ``change mark'' on the preceding or following line of output.

See Also
       cmp(1), comm(1), diff(1), nroff(1), join(1), sccsdiff(1), troff(1), uniq(1)

																	 diffmk(1)
All times are GMT -4. The time now is 11:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy