Sponsored Content
Top Forums Shell Programming and Scripting use vimdiff inside while read Post 302557970 by radoulov on Thursday 22nd of September 2011 12:01:30 PM
Old 09-22-2011
Try this:

Code:
while IFS= read -r; do
  diff src/"$REPLY" dest/"$REPLY" || ( 
    exec 0< /dev/tty
    vimdiff src/"$REPLY" dest/"$REPLY" 
    )
done < infile

These 2 Users Gave Thanks to radoulov For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

read inside a while loop

Hi all, In a while loop, like below... while read line do read choice case $choice in 1) echo "xxx" esac done < file why I can't run the read choice???? (3 Replies)
Discussion started by: dta4316
3 Replies

2. Shell Programming and Scripting

input inside while read loop

Hi all Does anyone have a script that will allow me to stop inside a while read loop. I want to pause the loop until a enter is pressed. e.g. While read line do echo something if LINECOUNT > 40 then read ENTER?"PRESS ENTER TO CONT..." ... (3 Replies)
Discussion started by: jhansrod
3 Replies

3. Shell Programming and Scripting

read command (input) inside the while loop

Hi, 'read' command is not working inside the while loop, How can I solve this? Rgds, Sharif. (2 Replies)
Discussion started by: sharif
2 Replies

4. Shell Programming and Scripting

how to read line inside expect script

hi, i have an existing ftp script that needs to be translated to SFTP so i have to use expect script to automate the login to the remote server. Now im facing with a problem becaise i have at least 50 files to be renamed ont he remote server. It's a hassle to hardcode every single command... (1 Reply)
Discussion started by: The One
1 Replies

5. Shell Programming and Scripting

Read from user inside a while statement

Hi there I want to ask to a user something about each line of a file. This is my code: #cat test.txt first line second line third line #cat test.sh #!/bin/ksh read_write () { echo "Do you want to print the line (YES/NO)?\n" read TEST case ${TEST} in YES) return 0;; ... (3 Replies)
Discussion started by: tirkha
3 Replies

6. UNIX for Advanced & Expert Users

how to read a file inside jar

how to read the text file inside the jar without extracting jar. (3 Replies)
Discussion started by: karthikn
3 Replies

7. UNIX for Advanced & Expert Users

vimdiff jump to other file or switch windows

This took me quite awhile to find so I wanted to share this with other people. To switch windows in vimdiff or to navigate windows in vimdiff or to change windows in vimdiff try the following: The ":vertical" command can be inserted before another command that splits a window. ... (0 Replies)
Discussion started by: cokedude
0 Replies

8. Shell Programming and Scripting

Update file record inside read loop

Hi, I am reading file records inside a while loop, and want to update the record when certain condition is met. How can I update a file while being read? I want to avoid using temporary files, copy, rename, ... while IFS=',' read -r f1 f2 do function(f1,f2) if then <add... (1 Reply)
Discussion started by: ysrini
1 Replies

9. Shell Programming and Scripting

Unable to read user input inside a loop

Hi, This query is a part of a much more lengthy script. I wish to look for all the files in a folder named "data" which in this case has two files i.e. plan.war and agent.properties. For all the files found under data I wish to ask the user as to where they wish copy the files to. Below,... (14 Replies)
Discussion started by: mohtashims
14 Replies

10. UNIX for Beginners Questions & Answers

Case inside While read File

Hi Experts, Need your guidance for case statement. I tried many way but no success yet.Now my existing code is doing something like below. Each Line of the input file contains one test case.#!/bin/bash FILE=$1 while read LINE; do do COMMAND done < $FILE Now I want to modify the code... (6 Replies)
Discussion started by: pradyumnajpn10
6 Replies
STPNCPY(3)						     Linux Programmer's Manual							STPNCPY(3)

NAME
stpncpy - copy a fixed-size string, returning a pointer to its end SYNOPSIS
#define _GNU_SOURCE #include <string.h> char *stpncpy(char *dest, const char *src, size_t n); DESCRIPTION
The stpncpy() function copies at most n characters from the string pointed to by src, including the terminating '' character, to the array pointed to by dest. Exactly n characters are written at dest. If the length strlen(src) is smaller than n, the remaining characters in the array pointed to by dest are filled with '' characters. If the length strlen(src) is greater or equal to n, the string pointed to by dest will not be '' terminated. The strings may not overlap. The programmer must ensure that there is room for at least n characters at dest. RETURN VALUE
stpncpy() returns a pointer to the terminating null in dest, or, if dest is not null-terminated, dest + n. CONFORMING TO
This function is a GNU extension. SEE ALSO
strncpy(3), wcpncpy(3), feature_test_macros(7) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
1999-07-25 STPNCPY(3)
All times are GMT -4. The time now is 09:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy