Sponsored Content
Top Forums Shell Programming and Scripting Shell pipeline help for a n00b Post 302575491 by Gbear on Tuesday 22nd of November 2011 12:57:42 AM
Old 11-22-2011
character 72. Sorry. Here is the sample input file

^\Be sure that you count the NEW characters to find where column 72 is^_^_^_$
A 72-character limit means only half of some 2-character codes survive:^X$
Make sure you don't mangle square brackets ('[' and ']').$
consecutive tabs (3 of them)$
12345678 1 2345678 2 2345678 3 2345678 4 2345678 5 2345678 6 2345678 7 2345678$
a ab abc abcd abcde abcdef x$
Embedded carriage returns can do unexpected^M things. $
Embedded backspaces can do unexpected ^H^H^H^H^H^H^H^H^Hwild and crazy things.$
The next line contains a delete character.$
^?$
Only control characters occur between the curly brackets in the next line.$
{^A^B^C^D^E^F^G^]^^^N^O^V^Z^[}$
Delete, null, and non-ascii characters occur between the curly brackets below.$
{^?^@M-^AM-~}$

---------- Post updated at 09:57 PM ---------- Previous update was at 09:55 PM ----------

Quote:
Originally Posted by ahamed101
column 72 or character 72?
Paste some sample input

Character 72
Code:
cut -c1-72 input_file

column 72 - delimiter tab assumed, if different use -d option
Code:
cut -f1-72 input_file

--ahamed

ok cool, so if I also need to display control characters with ^? notation, and display $ at the end of newlines is the following line sufficient? or am I missing something?

#! /bin/csh -f
cat -v -e | cut -c1-72 input_file
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

OpenBSD N00b: HELP ME!!! AGGGH!!

Note: This is not meant to start a flamewar. I am looking for serious answers to questions regarding OpenBSD. I'm coming to OpenBSD from an eight year background in Linux (specifically various versions of RedHat and now Fedora Core 3). I have some experience with Solaris 8 and HP-UX 11/11i. I... (1 Reply)
Discussion started by: deckard
1 Replies

2. UNIX for Dummies Questions & Answers

Absolute n00b questions about Unix / Linux

Hi All, I have absolutely no experince with either one, and would LOVE to start from somewhere! So please guide me to some web sites (beside these great forums of course!) that I can obtain n00b information. (Books, links, resources, etc.) What software OS? should I begin with? I have heard... (2 Replies)
Discussion started by: CodeHunter
2 Replies

3. UNIX for Dummies Questions & Answers

N00b question on CPU % in top

I have a process in my TOP output that is consistantly at 97% usage. I have 16 CPUs on my box. So is the 97% the cumalative usage of all the CPUs or just one? (3 Replies)
Discussion started by: kskywr
3 Replies

4. UNIX for Dummies Questions & Answers

N00b In Need!

Howdy all, just joined the forums after finding them on a good ole' google search. very impressed from what i've seen so far! I'm pretty new to the world of Unix/Linux, have just had a change of job role and been thrown in at the deep end! I'm now working on an Oracle 9i database using HPUX... (1 Reply)
Discussion started by: davesimm
1 Replies

5. Shell Programming and Scripting

Comments within a shell pipeline

I've got a very ugly pipeline for analyzing web server logs (but nevermind the application; I've come across this in other scripts as well). I want to nicely comment the steps in the pipeline, but I can't seem to do it. I know, for instance that in csh/sh/bash, a # begins a comment, and any... (2 Replies)
Discussion started by: otheus
2 Replies

6. Shell Programming and Scripting

scripting n00b question, please help :)

Okay, so I'm a little familiar with C and Linux, but my shell scripting experience is limited to say the least. I know that you begin a shell script with this #!/bin/bash Basically, I've written a C program that's output writes to a shell script. What my problem is, is I would like this shell... (4 Replies)
Discussion started by: beatzz
4 Replies

7. IP Networking

tcp n00b - can't ping router

please help! I have a sun blade with 2 x nics configured, both on different subnets. The eri0 interface (192.168.0.100) is connected to my router (192.168.0.1), but if i try to ping the router, it times out. any suggestions are welcome - i noticed the 2 mac addresses are the same, i've set... (7 Replies)
Discussion started by: badoshi
7 Replies

8. Shell Programming and Scripting

Shell Scripting n00b

Hey Guys! I was hoping for some help with a simple script I'm trying to use. I have the script set up to pull some simple information out of a database .txt file and sed it into a preexisting template for assignment cover letters. The problem seems to be someplace in the sed statement but I... (5 Replies)
Discussion started by: BFeicht
5 Replies

9. Shell Programming and Scripting

Unix Shell basic loop massive n00b

hey guys I would really appreciate some help, i need to do a project for a job that requires minimal UNIX scripting and im REALLY stuck basically Im stuck at what i believe is something really simple but i just dont have a clue how to do it efficiently and properly and i REALLY appreciate some... (16 Replies)
Discussion started by: thurft
16 Replies

10. UNIX for Dummies Questions & Answers

FTP EOF n00b Question

Hi folks, can you help me decipher this? I know that ftp will accept input from all commands until it encounters EOF again but I don't quite make sense of what the entirety of the script is really trying to achieve. Many thanks. ftp -n someserver << EOF | head -20 user username@server... (2 Replies)
Discussion started by: verargulla
2 Replies
TR(1)							      General Commands Manual							     TR(1)

NAME
tr - translate characters SYNOPSIS
tr [ -cds ] [ string1 [ string2 ] ] DESCRIPTION
Tr copies the standard input to the standard output with substitution or deletion of selected characters. Input characters found in string1 are mapped into the corresponding characters of string2. When string2 is short it is padded to the length of string1 by duplicat- ing its last character. Any combination of the options -cds may be used: -c complements the set of characters in string1 with respect to the universe of characters whose ASCII codes are 01 through 0377 octal; -d deletes all input characters in string1; -s squeezes all strings of repeated output characters that are in string2 to single characters. In either string the notation a-b means a range of characters from a to b in increasing ASCII order. The character `' followed by 1, 2 or 3 octal digits stands for the character whose ASCII code is given by those digits. A `' followed by any other character stands for that character. The following example creates a list of all the words in `file1' one per line in `file2', where a word is taken to be a maximal string of alphabetics. The second string is quoted to protect `' from the Shell. 012 is the ASCII code for newline. tr -cs A-Za-z '12' <file1 >file2 SEE ALSO
ed(1), ascii(7) BUGS
Won't handle ASCII NUL in string1 or string2; always deletes NUL from input. TR(1)
All times are GMT -4. The time now is 06:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy