On Christmas Eve, around 1812, Pip, an orphan who is about seven years old, encounters an escaped convict in the village churchyard while visiting the graves of his mother Georgiana, father Philip Pirrip and siblings. The convict scares Pip into stealing food and a file to grind away his shackles, from the home he shares with his abusive elder sister and her kind husband Joe Gargery, a blacksmith. The next day, soldiers recapture the convict while he is engaged in a fight with another escaped convict; the two are returned to the prison ships.
Miss Havisham, a wealthy spinster who wears an old wedding dress and lives in the dilapidated Satis House, asks Pip's Uncle Pumblechook (who is Joe's uncle) to find a boy to visit. Pip visits Miss Havisham and her adopted daughter Estella, falling in love with Estella on first sight, both quite young. Pip visits Miss Havisham regularly until it comes time for him to learn a trade; Joe accompanies Pip for the last visit when she gives the money for Pip to be bound as apprentice blacksmith. Pip settles into learning Joe's trade. When both are away from the house, Mrs. Joe is brutally attacked, leaving her unable to speak or do her work. Biddy arrives to help with her care and becomes 'a blessing to the household'.
Four years into Pip's apprenticeship, Mr. Jaggers, a lawyer, approaches him in the village with the news that he has expectations from an anonymous benefactor, with immediate funds to train him in the gentlemanly arts. He will not know the benefactor's name until that person speaks up. Pip is to leave for London in the proper clothes. He assumes that Miss Havisham is his benefactor. He visits her to say good-bye.
Pip sets up house with Herbert Pocket at Barnard's Inn. Herbert tells Pip the circumstances of Miss Havisham's romantic disappointment, her jilting by her fianc . Pip goes to Hammersmith, to be educated by Mr Matthew Pocket, Herbert's father. Jaggers disburses the money Pip needs to set himself up in his new life. Joe visits Pip at Barnard's Inn, where Pip is a bit ashamed of Joe. Joe relays the message from Miss Havisham that Estella will be at Satis House for a visit. Pip and Herbert exchange their romantic secrets - Pip adores Estella and Herbert is engaged to Clara.
Pip and Herbert build up debts. Mrs Joe dies and Pip returns to his village for the funeral. Pip's income is fixed at  500 per annum when he comes of age at twenty-one. Pip takes Estella to Satis House. She and Miss Havisham quarrel. At the Assembly Ball in Richmond Estella meets Bentley Drummle, a brute of a man. A week after he turns 23 years old, Pip learns that his benefactor is the convict from so long ago, Abel Magwitch, who had been transported to New South Wales after that escape. He became wealthy after gaining his freedom there. As long as he is out of England, Magwitch can live. But he returns to see Pip. Pip was his motivation for all his success in New South Wales. Pip is shocked, ceasing to take money from him. He and Herbert Pocket devise a plan to get Magwitch out of England, by boat. Magwitch shares his past history with Pip.
Pip tells Miss Havisham that he is as unhappy as she can ever have meant him to be. He asks her to finance Herbert Pocket. Estella tells Pip she will marry Bentley Drummle.
Miss Havisham tells Pip that Estella was brought to her by Jaggers aged two or three. Before Pip leaves the property, Miss Havisham accidentally sets her dress on fire. Pip saves her, injuring himself in the process. She eventually dies from her injuries, lamenting her manipulation of Estella and Pip. Jaggers tells Pip how he brought Estella to Miss Havisham from Molly. Pip figures out that Estella is the daughter of Molly and Magwitch.
A few days before the escape, Joe's former journeyman Orlick seizes Pip, confessing past crimes as he means to kill Pip. Herbert Pocket and Startop save Pip and prepare for the escape. On the river, they are met by a police boat carrying Compeyson for identification of Magwitch. Compeyson was the other convict years earlier, and as well, the con artist who wooed and deserted Miss Havisham. Magwitch seizes Compeyson, and they fight in the river. Magwitch survives to be taken by police, seriously injured. Compeyson's body is found later.
Pip visits Magwitch in jail and tells him that his daughter Estella is alive. Magwitch responds by squeezing Pip's palm and dies soon after, sparing an execution. After Herbert goes to Cairo, Pip falls ill in his rooms. He is confronted with arrest for debt; he awakens to find Joe at his side. Joe nurses Pip back to health and pays off the debt. As Pip begins to walk about on his own, Joe slips away home. Pip returns to propose to Biddy, to find that she and Joe have just married. Pip asks Joe for forgiveness, and Joe forgives him. As Magwitch's fortune in money and land was seized by the court, Pip no longer has income. Pip promises to repay Joe. Herbert asks him to join his firm in Cairo; he shares lodgings with Herbert and Clara and works as a clerk, advancing over time.
Eleven years later, Pip visits the ruins of Satis House and meets Estella, widow to the abusive Bentley Drummle. She asks Pip to forgive her, assuring him that misfortune has opened her heart and that she now empathises with Pip. As Pip takes Estella's hand and leaves the ruins of Satis House, he sees "no shadow of another parting from her."
Output: What is Joe Gargery's trade?