Sponsored Content
Top Forums Shell Programming and Scripting String concatenation not working in a loop Post 302389827 by Franklin52 on Tuesday 26th of January 2010 04:09:52 AM
Old 01-26-2010
If you don't read lines (filenames) with spaces it isn't necessary to change the IFS.

Regards
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

string concatenation

my input file contains thousands of lines like below 234A dept of education 9788 dept of commerce 8677 dept of engineering How do i add a delimeter ':' after FIRST 4 CHARACTERS in a line 234A:dept of education 9788:dept of commerce 8677:dept of engineering (7 Replies)
Discussion started by: systemsb
7 Replies

2. Shell Programming and Scripting

String handling is not working inside if loop

Hi All, I am comparing two strings inside an if condition if the strings are same then it should go inside the loop else it should execute code given in else part. But there is a but inside my script Even if the if condition is true it is not going inside the loop also it is executing... (4 Replies)
Discussion started by: usha rao
4 Replies

3. Shell Programming and Scripting

String Concatenation

Hi All, I need to concatenate the values in the array into a variable. Currently the code is : for (( i=1 ; i <= $minCount ; i++ )) do var="${var}""${sample_file}" done The output is : /tmp/1/tmp/2/tmp/3/tmp/4/tmp/5/tmp/6/tmp/7/tmp/8/tmp/9/tmp/10 I need a space between... (1 Reply)
Discussion started by: sh_kk
1 Replies

4. Shell Programming and Scripting

String comparison not working inside while loop

Hi, In the code included below, the string comparision is not working fine. Please help while (( find_out >= i )) do file=`head -$i f.out|tail -1` dir=`dirname $file` cd $dir Status="" if ; then Status=`cvs -Q status... (3 Replies)
Discussion started by: sudvishw
3 Replies

5. Shell Programming and Scripting

string comparison not working inside while loop

The string comparison highlighted below is not working fine. Please help: while read line do # Get File name by deleting everything that preceedes and follows Filename as printed in cvs status' output f_name=`echo $line | sed -e 's/^File://' -e 's/ *Status:.*//' | awk '{print $NF}'` ... (4 Replies)
Discussion started by: sudvishw
4 Replies

6. Shell Programming and Scripting

String concatenation

Hi, I have two files. cat file.txt a b c d cat file1.txt j k l m I need the output as a:j (12 Replies)
Discussion started by: nareshkumar522
12 Replies

7. Shell Programming and Scripting

String concatenation problem

Hi there, I'm writing a basic script where I want to make a string of 2 numeric fields from a file, which I have done, but the behavior is rather confusing. I have a file of random values such as: 1 2 3 4 5 6 7 8 9 10 and my awk code is: BEGIN { FS = " " } { str = str $1 $2 } END {... (7 Replies)
Discussion started by: HMChadwick
7 Replies

8. Shell Programming and Scripting

Concatenation in awk not working

Hello I want to achieve the following. However the concatenation is not working mv `ls -ltr *myfile*.log|awk '{print $9}'` `ls -ltr *myfile*.log|awk '{print `date +'%d%m%y%k%M%S'` $9}'` I tried awk '{x=`date +'%d%m%y%k%M%S'` print $x "" $9}' awk '{x=`date +'%d%m%y%k%M%S'`... (2 Replies)
Discussion started by: Chetanz
2 Replies

9. Shell Programming and Scripting

String variable concatenation through loop problem

Hi Team!! Please can anyone tell me why the following line does not work properly? str3+=$str2 it seems that str3 variable does not keep its value in order to be concatenated in the next iteration! Thus when i print the result of the line above it returns the str2 value What i want to do is to... (8 Replies)
Discussion started by: paladinaeon
8 Replies

10. Shell Programming and Scripting

Help with String concatenation

I have a script which is migrated from AIX to Linux & now while running it is no able to concatenate string values The string concatenation step under while loop is not displaying desired result Please find below the piece of code: while read EXT_FILE ; do EXT_FILE=$EXT_FILE.ext.sent echo... (7 Replies)
Discussion started by: PreetArul
7 Replies
FLIP(1) 						     Linux Programmer's Manual							   FLIP(1)

NAME
flip, toms, toix - do newline conversions between **IX and MS-DOS SYNOPSIS
flip -h flip [ -umvtsbz] file ... flip [ -umvtsbz] - toix [ -vtsbz] file ... toms [ -vtsbz] file ... DESCRIPTION
flip is a file interchange program that converts text file formats between **ix and MS-DOS. It converts lines ending with carriage-return (CR) and linefeed (LF) to lines ending with just linefeed, or vice versa. If the special argument "-" is given, input is read from stdin and written to stdout. flip has the following features: flip will normally refuse to convert binary files. You can override this. When asked to convert a file to the same format that it already has, flip causes no change to the file. Thus to convert all files to **IX format you can type flip -u * and all files will end up right, regardless of whether they were in MS-DOS or in **IX format to begin with. This also works in the opposite direction. If a file contains isolated CR characters for underlining or overprinting, flip does not change them. flip preserves file timestamps. You can override this. flip preserves file permissions. flip is written in C and will compile and run under MS-DOS/Turbo C, 4.3BSD, and System V. flip accepts wildcards and multiple filenames on the command line. If a user interrupt aborts flip, it does not leave behind any garbage files or cause corruption of the files being converted. When converting from MS-DOS to **IX format, flip removes any trailing control Z (the last character in the file), but leaves embed- ded control Z characters unchanged. This minimizes the possibility of accidentally converting a binary file that contains a control Z near the beginning. You can override this and ask flip to recognize the first control Z found as end-of-file. flip can be asked to strip the high (parity) bit as it converts a file. flip is normally invoked as: flip -umhvtb file ... One of -u, -m, or -h is required. Switches may be given separately or combined together after a dash. For example, the three command lines given below are equivalent: flip -uvt *.c flip -u -v -t *.c flip -u -vt *.c On systems that allow a program to know its own name, flip may be renamed (or linked) to a file called toix for conversion to **IX format, or to a file called toms for conversion to MS-DOS format. When invoked with the name toix or toms, flip will act as if it were invoked with the -u or -m option respectively. OPTIONS
-u Convert to **IX format (CR LF => LF, lone CR or LF unchanged, trailing control Z removed, embedded control Z unchanged). -m Convert to MS-DOS format (lone LF => CR LF, lone CR unchanged). -h Give a help message. -v Be verbose, print filenames as they are processed. -t Touch files (don't preserve timestamps). -s Strip high bit. -b Convert binary files too (else binary files are left unchanged). -z Truncate file at first control Z encountered. AUTHOR
Rahul Dhesi <dhesi@bsu-cs.bsu.edu>. SEE ALSO
unix2dos(1), dos2unix(1). Linux 2.0 July 20, 2002 FLIP(1)
All times are GMT -4. The time now is 08:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy