Sponsored Content
Full Discussion: stack problem
Top Forums UNIX for Dummies Questions & Answers stack problem Post 18714 by Jimbo on Tuesday 2nd of April 2002 09:53:45 AM
Old 04-02-2002
Quote:
I understand this will return the final character of the $file variable.
Just to be clear, we are talking about returning the first or final character of a file, and does not matter if it is referenced by actual name or the filename is contained in a variable. Returning portions of what is currently held in a variable is very common, but I think not what we want here.

OK, so head -1 myfile gets you the first line. Now pipe that into a command that will cut the first column out. But if the first line is empty, this solution results in null:
Code:
char1=`head -1 myfile | cut -c1`
echo "first character is $char1"

Jimbo
 

7 More Discussions You Might Find Interesting

1. Programming

memory stack problem

Hi, I am writing a C program under SCO Unix. I have a memory stack problem but do not know how to go about fixing it. I have tried running INSURE but that does not detect any problems. Essentially the problem is that the memory address shifts on return from a routine. I pass a pointer to... (3 Replies)
Discussion started by: jkeagy
3 Replies

2. Programming

stack query

can anyone explain how the local variables are acessed from a stack frame of that particular function..since stacks can only push or pop values and stack pointer always points to top of the stack and the frame pointer always points to the end of the previous stack frame..how local variables are... (4 Replies)
Discussion started by: aloksave
4 Replies

3. Programming

what is stack winding and stack unwinding

helo can u tell me what do you mean by stack winding and stack unwinding Regards, Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies

4. HP-UX

Problem with stack overflow

Hi, I get a problem with stack overflow on HP-UX, when running a C program. Pid 28737 received a SIGSEGV for stack growth failure. Possible causes: insufficient memory or swap space, or stack size exceeded maxssiz. The possible cause i found, was that the definition of a structure had... (0 Replies)
Discussion started by: karthikb23
0 Replies

5. UNIX for Dummies Questions & Answers

Kernel Stack vs User Mode Stack

Hi, I am new to the linux kernel development area. I want to know what is the difference between kernel mode stack and user mode stack? Does each process has a user mode stack and a kernel mode stack?? Or Each process has a user mode stack and there is only one kernel mode stack that is shared by... (4 Replies)
Discussion started by: saurabhkoar
4 Replies

6. Shell Programming and Scripting

Stack Trace

Hi All Thought it would be kind of fun to implement a stack trace for a shell script that calls functions within a sub shell. This is for bash under Linux and probably not portable - #! /bin/bash error_exit() { echo "=======================" echo $1 echo... (4 Replies)
Discussion started by: steadyonabix
4 Replies

7. UNIX for Dummies Questions & Answers

What happens to the stack?

Consider this bad code, edited in Windows and run via CygWin after dos2unix so be aware of any hidden "\r" charatcers... #!/bin/bash n=0 stackit() { eval $1 if then exit 0 fi n=$ echo "$n" stackit stackit } stackit stackit Run under CygWin:- AMIGA:~> cd /tmp AMIGA:/tmp>... (2 Replies)
Discussion started by: wisecracker
2 Replies
PAGESJAUNES(1p) 					User Contributed Perl Documentation					   PAGESJAUNES(1p)

NAME
pagesjaunes - Lookup phones numbers from www.pagesjaunes.fr SYNOPSIS
pagesjaunes [options ...] Options: -activite -business : Business type -nom -name : Name -prenom -firstname : First name -localite -town : Town -departement -district : Dept district or Region -useragent : String to be passed as User-Agent header (this may be needed to bypass user-agent detection) -fast : Submit the request directly without querying the form -separator : Character used to separate the fields (default ' ') -limit : Maximum number of results returned -english : Use the pagesjaunes.fr english interface -quiet : Turn off error messages display -help : Brief help message -man : Full documentation -version : Display version number You must provide the localite/town option, and either activite/business or nom/name option. The prenom/firstname option is ignored if the localite/town option is set. OPTIONS
-activite or -business Activity or business type you're looking for. This is a mandatory switch if you don't specify the -name or -nom switches. -nom or -name Name of the person or company you're looking for. Note that the search is done with a fuzzy match. -prenom or -firstname First name of the person you're looking for. This option is ignored if the -activite or -business are set. -adresse or -address Address of the person you're searching for. -localite or -town Name of the town. -department or -district Department district or Region you're searching in. -separator Character used to separate fields in the result set. Default is a tabulation character. -useragent The default user-agent string passed to the www.pagesjaunes.fr site is ""WWW::Search::Pagesjaunes/x.xx" where x.xx is the version of the module. Sometimes, it is needed to change it to other user-agent strings. -limit Maximum number of entries returned. Default is 50. If you set it to 0 or a negative number, it will return all the entries found. -english Use the english interface of pagesjaunes.fr. This means that you can enter business types in english (i.e. 'plumber' instead of 'plombier'), and error messages will be displayed in english. -quiet No error messages are printed when this switch is on -help Print a brief help message and exits. -man Prints the manual page and exits. -version Prints the version of the script and exits. DESCRIPTION
This script provides name, phone number and addresses of French telephone subscribers by using the http://www.pagesjaunes.fr directory and the WWW::Search::Pagesjaunes module. COPYRIGHT
Please read the Publisher information of <http://www.pagesjaunes.fr> available at the following URL: http://www.pagesjaunes.fr/pj.cgi?html-=commun/avertissement.html&lang=en <http://www.pagesjaunes.fr/pj.cgi?html-=commun/avertissement.html&lang=en> This script is Copyright (C) 2002, Briac Pilpre This script is free software; you can redistribute it or modify it under the same terms as Perl itself. AUTHOR
Briac Pilpre <briac@cpan.org> perl v5.12.4 2011-11-02 PAGESJAUNES(1p)
All times are GMT -4. The time now is 05:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy