Sponsored Content
Top Forums Shell Programming and Scripting list file content as individual variables Post 302359368 by Scott on Tuesday 6th of October 2009 11:16:44 AM
Old 10-06-2009
Hi.

Code:
read old_ctrl new_ctrl <<< $(ls -tr | tail -2)

(for ksh...)
Code:
echo $(ls -tr | tail -2) | read old_ctrl new_ctrl


Last edited by Scott; 10-06-2009 at 12:31 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Put content of file into variables

How to put a line of strings (with some white spaces in between) from a file into variables? I have tried the following codes. However, the content is cut by space (not by line) for i in `cat ${source_file}` do echo $i done Please comment. Thanks. (2 Replies)
Discussion started by: Rock
2 Replies

2. AIX

find for specific content in file in the directory and list only file names

Hi, I am trying to find the content of file using grep and find command and list only the file names but i am getting entire file list of files in the directory find . -exec grep "test" {} \; -ls Can anyone of you correct this (2 Replies)
Discussion started by: madhu_Jagarapu
2 Replies

3. Shell Programming and Scripting

Need help with awk - how to read a content of a file from every file from file list

Hi Experts. I need to list the file and the filename comes from the file ListOfFile.txt. Basicly I have a filename "ListOfFile.txt" and it contain Example of ListOfFile.txt /home/Dave/Program/Tran1.P /home/Dave/Program/Tran2.P /home/Dave/Program/Tran3.P /home/Dave/Program/Tran4.P... (7 Replies)
Discussion started by: tanit
7 Replies

4. Shell Programming and Scripting

Moving Content from one file to another with variables

Greetings All, Need some help, your input is appreciated. Scenario: I have five files, each has one line with comletely different content. I execute the command to combine all the five lines of content into a single file. Goal: I would like to take that single file that has the... (3 Replies)
Discussion started by: royarellano
3 Replies

5. UNIX for Dummies Questions & Answers

How to list content with file name ?

I want to search the string including the symbol like 'search' for example, file a.txt in \\dir contains, a for 'appable' b for 'banana' c for 'cat' s for 'search' Here I need to display(serach outpur) like \\dir\a.txt s for 'search' ... ... How to list content with file name... (5 Replies)
Discussion started by: gkskumar
5 Replies

6. Shell Programming and Scripting

Turning CSV files into individual Variables

I want to be able to convert the following data from a CSV into individual variables from the columns 2 4 and 8 I can use awk to grab the columns using var1=`cat text.csv | awk "," '{print $2}'` but how do I create separate variables for each line. 595358 ,ECON1010 ,THU ,08:00 - 10:00 ,11 Mar... (6 Replies)
Discussion started by: domsmith
6 Replies

7. UNIX for Dummies Questions & Answers

Parse or cut concat variables to individual values

Hello I need to pass some environment parameters to a datastage job and am getting an error when trying to send the complete concatinated variable. I have decided to parse out just the values and send as parameters but am struggling to find the best way to do this (actually I am not very... (3 Replies)
Discussion started by: LynnC
3 Replies

8. Shell Programming and Scripting

list file content

I need help. I have this file, it has 2 fields with at least 300 lines: 1 4 2 3 3 6 4 2 . . 300 5 My output should be for every line in input file the output should be like this, for example line 1: wget http://somewebsite/page=1&line=1 wget http://somewebsite/page=1&line=2 wget... (4 Replies)
Discussion started by: zorrox
4 Replies

9. UNIX for Dummies Questions & Answers

List all File Content its subdirectory

Is there anyway to display the file content in a subdirectory that starts or ends with a certain filename, say .txt? or start with NTS $ ls * dos2unix.bat dos2unix.exe test.txt FilePermissions: filepermission.html NTSLA32_SystemDrive.txt NTSLA36_regedit.txt filepermission.sh ... (1 Reply)
Discussion started by: alvinoo
1 Replies

10. Shell Programming and Scripting

List the files after sorting based on file content

Hi, I have two pipe separated files as below: head -3 file1.txt "HD"|"Nov 11 2016 4:08AM"|"0000000018" "DT"|"240350264"|"56432" "DT"|"240350264"|"56432" head -3 file2.txt "HD"|"Nov 15 2016 2:18AM"|"0000000019" "DT"|"240350264"|"56432" "DT"|"240350264"|"56432" I want to list the... (6 Replies)
Discussion started by: Prasannag87
6 Replies
Ns_Info(3aolserver)					   AOLserver Library Procedures 				       Ns_Info(3aolserver)

__________________________________________________________________________________________________________________________________________________

NAME
Ns_InfoAddress, Ns_InfoBootTime, Ns_InfoBuildDate, Ns_InfoConfigFile, Ns_InfoErrorLog, Ns_InfoHomePath, Ns_InfoHostname, Ns_InfoLabel, Ns_InfoNameOfExecutable, Ns_InfoPid, Ns_InfoPlatform, Ns_InfoServerName, Ns_InfoServerVersion, Ns_InfoServersStarted, Ns_InfoShutdownPend- ing, Ns_InfoStarted, Ns_InfoTag, Ns_InfoUptime, Ns_PageRoot - Get server information SYNOPSIS
#include "ns.h" char * Ns_InfoAddress(void) int Ns_InfoBootTime(void) char * Ns_InfoBuildDate(void) char * Ns_InfoConfigFile(void) char * Ns_InfoErrorLog(void) char * Ns_InfoHomePath(void) char * Ns_InfoHostname(void) char * Ns_InfoLabel(void) char * Ns_InfoNameOfExecutable(void) int Ns_InfoPid(void) char * Ns_InfoPlatform(void) char * Ns_InfoServerName(void) char * Ns_InfoServerVersion(void) int Ns_InfoServersStarted(void) int Ns_InfoShutdownPending(void) int Ns_InfoStarted(void) char * Ns_InfoTag(void) int Ns_InfoUptime(void) char * Ns_PageRoot(char *server) _________________________________________________________________ DESCRIPTION
These functions return information about the server. Many of the functions return pointers to strings or other types of information which, in most cases, you must not free. These are denoted as "read-only" in the sections below. Ns_InfoAddress() Return the server IP address of the server. The IP address is defined in the server configuration file. The IP address is returned as a string pointer which you must treat as read-only. If you want to alter the string, you must use ns_strdup to copy the string to another location in memory and modify that instead. Ns_InfoBootTime() Return the time that the server was started as an int. Treat the result as time_t. Ns_InfoBuildDate() Return the date and time that this server was compiled as a string pointer. Treat the result as read-only. Ns_InfoConfigFile() Return the absolute path name of the configuration file in use as a string pointer. Treat the result as read-only. Ns_InfoErrorLog() Return the name of the error log as a string pointer. Treat the result as read-only. The name may be just a name, a relative path or an absolute path depending on how it is defined in the server configuration file. Ns_InfoHomePath() Return the absolute directory path where AOLserver is installed as a string pointer. Treat the result as read-only. Ns_InfoHostname() Return the hostname of the host that AOLserver is running on as a string pointer. The gethostname(2) function is used. If gethost- name(2) fails to return a hostname, "localhost" is used instead. Treat the result as read-only. Ns_InfoLabel() Return the source code label for AOLserver as a string pointer. Statically defined in the source code. If no label was used, "unla- beled" is returned. You can use these functions to provide the source code label when you report problems with the server. Treat the result as read-only. Ns_InfoNameOfExecutable() Return the name of the running executable as a string pointer. Treat the result as read-only. Ns_InfoPid() Return the pid of the running AOLserver executable as an int. Ns_InfoPlatform() Return the platform name as a string pointer, e.g. "linux". Treat the result as read-only. Ns_InfoServerName() Return the AOLserver name string, e.g. "AOLserver". Statically defined in the source code. Treat the result as read-only. Ns_InfoServerVersion() Return the AOLserver version string, e.g. "3.5.2". Statically defined in the source code. Treat the result as read-only. Ns_InfoServersStarted() Return TRUE if the server has started, i.e., if initialization and module loading is complete. This is a compatibility function that calls Ns_InfoStarted. Ns_InfoShutdownPending() Return TRUE if there is there a shutdown pending, i.e. if an INTR signal has been received or if ns_shutdown has been called. Ns_InfoStarted() Return TRUE if the server has started, i.e., if initialization and module loading is complete. Ns_InfoTag() Return the CVS tag of this build of AOLserver. Statically defined in the source code. The value may be meaningless. Treat the result as read-only. Ns_InfoUptime() Return how long, in seconds, AOLserver has been running. Ns_PageRoot(server) Return the path name of the AOLserver pages directory for a particular server as a string pointer. The server argument is not used. Treat the result as read-only. SEE ALSO
nsd(1), info(n) KEYWORDS
AOLserver 4.0 Ns_Info(3aolserver)
All times are GMT -4. The time now is 08:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy