Sponsored Content
Full Discussion: Homework :(
Top Forums UNIX for Dummies Questions & Answers Homework :( Post 302340523 by mb774 on Monday 3rd of August 2009 05:53:57 PM
Old 08-03-2009
Question Homework :(

1. You have a very large file, named 'ColMe', tab-delimited, you are asked to process. You are told that each line in 'ColMe' has 7 columns, and that the values in the 5th column are integers. Using shell functions (and standard LINUX/UNIX filters), indicate how you would verify that these conditions were satisfied in 'ColMe'. 2. In the same file, you are told that each value in column 1 is unique. How would you verify that?
3. Write a shell function that counts the number of occurrences of the word “SpecStr” in the file 'ColMe'.
4. Please show how you would do this in PERL, or related language.
 

7 More Discussions You Might Find Interesting

1. Post Here to Contact Site Administrators and Moderators

Homework?

https://www.unix.com/shell-programming-scripting/113946-scripts.html Looks like an assignment or homework to me, does it to you? (5 Replies)
Discussion started by: TonyFullerMalv
5 Replies

2. Homework & Coursework Questions

Homework Help.

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hello, My name is Jordan and studying at the New Bulgarian University in Sofiya. This is my homework but can... (2 Replies)
Discussion started by: freestar
2 Replies

3. Homework & Coursework Questions

Need some help with my homework

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Hi, since I'm relatively new to Unix I need some help. I've installed FreeBSD 8 on a virtual machine and I've done... (4 Replies)
Discussion started by: iLeeT777
4 Replies

4. Shell Programming and Scripting

Homework

1. Write a shell script to print the file names of all files having .txt extension of a given directory after converting to uppercase letters. The input (directory name) should be given as command line argument. The script will also check whether sufficient arguments are passed or not and whether... (1 Reply)
Discussion started by: aninda1989
1 Replies

5. Homework & Coursework Questions

Please help me with my homework!!!

A shell script is a script written for the shell, or command line interpreter, of an operating system. Typical operations performed by shell scripts include file manipulation, program execution, printing text etc. Shell : In computing, a shell is a piece of software that provides an interface for... (1 Reply)
Discussion started by: ubun
1 Replies

6. Homework & Coursework Questions

Homework

plz i need code to search about numbers like this : 962785785698 962795565488 962785321565 962777321684 962795979515 i need code to detect just numbers start with "96278" i need it in awk !! thanks (1 Reply)
Discussion started by: eyad mohammad
1 Replies

7. Homework & Coursework Questions

Homework Help

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 2. Relevant commands, code, scripts, algorithms: Write a command to display lines ending with the... (1 Reply)
Discussion started by: elh009
1 Replies
expand(1)						      General Commands Manual							 expand(1)

NAME
expand, unexpand - Replaces tab characters with spaces or spaces with tab characters SYNOPSIS
Current syntax expand [-t tablist] [file...] unexpand [-a | -t tablist] [file...] Obsolescent syntax expand [-tabstop | -tab1,tab2,...,tabn] [file...] STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: expand: XCU5.0 unexpand: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Replaces spaces at the beginning of each line with a tab, and inserts tab characters wherever their presence compresses the resultant file by replacing two or more characters. When the -t option is specified with the unexpand command, the -a option has no effect. (This option applies to the unexpand command only.) Specifies the tab stops. The tablist argument consists of a single positive decimal integer or multiple positive decimal integers, separated by spaces or commas, in ascending order. If a single number is specified, tabs are set tab- list column positions apart instead of the default (8). If multiple numbers are specified, tabs are set at those specific column posi- tions. Tabbing to tab stop position n thus causes the next character output to be in the (n+1)th column position on that line. If expand has to process a tab character at a position beyond the last of those specified in a multiple tab stop list, the tab char- acter is replaced by a single space in the output. Sets tab stops tabstop spaces apart instead of the default (8). (Obsolescent) Sets tab stops at specified columns. (Obsolescent) [Tru64 UNIX] Columns are measured in bytes. OPERANDS
The path name of a file to be processed. If you do not specify this operand, standard input is read. DESCRIPTION
The expand command changes tab characters to spaces in the named files, or the standard input, and writes the result to the standard out- put. The unexpand command puts tab characters into the data from the standard input, or the named files, and writes the result to the standard output. Backspace characters are preserved in the output and decrement the column count for tab calculations. The column position count cannot be decremented below one. The expand command is useful for preprocessing character files (before sorting, looking at specific columns, and so on.) that contain tab characters. By default, unexpand converts only spaces that are within sequences of spaces and tab characters at the beginnings of lines. Use -a to convert other sequences of spaces. NOTES
If the expand command encounters difficulties opening any specified file, it writes an error message to standard error and terminates imme- diately with an error status. If the unexpand command encounters difficulties opening any specified file, it writes an error message to standard error and continues operation. The exit status will reflect the error. EXIT STATUS
The following exit values are returned by either command: Successful completion. An error occurred. EXAMPLES
To replace tab characters in file with spaces, enter: expand file To replace the spaces in file with tab characters, enter: unexpand -a file ENVIRONMENT VARIABLES
The following environment variables affect the execution of expand and unexpand: Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the inter- nationalization variables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non- empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MESSAGES. SEE ALSO
Commands: fold(1), tabs(1) Standards: standards(5) expand(1)
All times are GMT -4. The time now is 07:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy